Module Os_db
This module defines low level functions for database requests.
include module type of Os_core_db
module PGOCaml : PGOCaml_generic.PGOCAML_GENERIC with type 'a monad = 'a Lwt.tval init :
?host:string ->
?port:int ->
?user:string ->
?password:string ->
?database:string ->
?unix_domain_socket_dir:string ->
?pool_size:int ->
?init:(PGOCaml.pa_pg_data PGOCaml.t -> unit Lwt.t) ->
unit ->
unitinit ?host ?port ?user ?password ?database ?unix_domain_socket_dir ?init () initializes the variables for the database access and register a function init invoked each time a connection is created.
val full_transaction_block :
(PGOCaml.pa_pg_data PGOCaml.t -> 'a Lwt.t) ->
'a Lwt.tfull_transaction_block f executes function f within a database transaction. The argument of f is a PGOCaml database handle.
val without_transaction :
(PGOCaml.pa_pg_data PGOCaml.t -> 'a Lwt.t) ->
'a Lwt.twithout_transaction f executes function f outside a database transaction. The argument of f is a PGOCaml database handle.
val connection_pool :
unit ->
PGOCaml.pa_pg_data PGOCaml.t Resource_pooling.Resource_pool.tDirect access to the connection pool
Setup a wrapper function which is used each time a connection is acquired. This function can perform some actions before and/or after the connection is used.
val set_connection_wrapper : wrapper -> unitexception No_such_resourceException raised when no resource corresponds to the database request.
exception Wrong_passwordException raised when password do not match.
exception Password_not_setException raised when user has no password.
exception No_such_userException raised when users attempts to connect with unknown identifier.
exception Empty_passwordException raised when user attempts to connect with empty password.
exception Main_email_removal_attemptException raised when there is an attempt to remove the main email.
exception Account_not_activatedException raised when the account is not activated.
val pwd_crypt_ref :
((string -> string) * (Os_types.User.id -> string -> string -> bool)) refpwd_crypt_ref is a reference to (f_crypt, f_check) where
f_crypt pwdis used to encrypt the passwordpwd.f_check userid pwd hashed_pwdreturnstrueif the hash ofpwdand the hashed passwordhashed_pwdof the user with iduseridmatch. If they don't match, it returnsfalse.
module Email : sig ... endThis module is used for low-level email management with database.
module User : sig ... endThis module is used for low-level user management with database.
module Groups : sig ... endThis module is low-level and used to manage groups of user.
module Phone : sig ... endManage user phone numbers