package mmdb

  1. Overview
  2. Docs

Module MmdbSource

Binding to the maxminddb library which parses the MMDB format commonly known as GeoIP2

Sourcetype t

Reference to an MMBD file

Sourceexception Binding_integrity_error of string

Thrown when an error is detected that is an internal error of the library, not a usage error. It is recommended not to handle this, instead report a bug report in the library

Sourcemodule Common_error : sig ... end
Sourcemodule Open_file_error : sig ... end
Sourcemodule Fetch_ip_data_error : sig ... end
Sourcemodule Fetch_value_error : sig ... end
Sourcemodule Fetch_error : sig ... end
Sourceval library_version : string

The version string of the underlying C library

Sourcemodule Path : sig ... end
Sourceval open_file : Path.t -> (t, Open_file_error.t) result

Open an MMDB file and return a reference to it

Sourcemodule Version_number : sig ... end
Sourceval binary_format_version : t -> Version_number.t

The version number of the binary format in underlying MMDB file

Sourcemodule Language : sig ... end
Sourceval languages : t -> Language.t list

Retrieves a list of languages supported by the database

Sourceval language_by_code : t -> string -> Language.t option

Retrieves a specific language by its language code

Sourcemodule Ip : sig ... end
Sourcetype ip_data

An opaque reference to the data structure associated with an IP address

Sourceval fetch_ip_data : t -> Ip.t -> (ip_data, Fetch_ip_data_error.t) result

Retrieves the data associated with the supplied IP address

Sourcemodule type VALUE_TYPE = sig ... end

Signatures for handling queries that yield a particular type of answer

Sourcetype any_value =
  1. | String of string
  2. | Float of float
  3. | Int of int
  4. | Bool of bool

The supported atomic value types that can be retrieved from a database

Sourcemodule Any : VALUE_TYPE with type answer = any_value

Interface to query for values of type any_value. This may come useful in case the database contains different value types at the same query path. Specialized modules for retrieving strings, floats, integers and booleans are available below.

Sourcemodule String : sig ... end

Interface for retrieving string values from the database

Sourcemodule Float : VALUE_TYPE with type answer = float

Interface for retrieving float values from the database

Sourcemodule Int : VALUE_TYPE with type answer = int

Interface for retrieving integer values from the database

Sourcemodule Bool : VALUE_TYPE with type answer = bool

Interface for retrieving boolean values from the database

Sourcemodule Coordinates : sig ... end

Interface for retrieving coordinate values from the database

OCaml

Innovation. Community. Security.