Library
Module
Module type
Parameter
Class
Class type
Maxmind is a binding to libmaxminddb with some higher level functionality on the OCaml side. Be aware that operations with the C side are liable to raise exceptions
val create : path:string -> mmdb
Create a handle on a mmdb descriptor based off a .mmdb database file. Maxminddb comes with City, Country databases in etc
val close : mmdb -> unit
Close a handle on a mmdb descriptor, bad things will happen if you try to use the handle after you called closed on it.
val dump : ?ip:string -> mmdb -> string
Dumps the database as a string; if ip is provided then dumps the database for this particular ip address, if no ip provided then dumps Metainformation about the database itself. Note that you should do not depend on this structure: it is not JSON, just looks like it.
For a given ip address, think 127.0.0.1, query path and mmdb handle, get the result. Note path must be safe, look at dump first
val postal_code : ip:string -> mmdb -> string
Short cut function for getting postal code from ip address
val with_mmdb : path:string -> (mmdb -> 'a) -> unit
Convenience function that opens and closes a mmdb for you