Silo
val string : string -> Dbcaml.Params.t
String param
val number : int -> Dbcaml.Params.t
Number param
val float : float -> Dbcaml.Params.t
Float param
val bool : bool -> Dbcaml.Params.t
Bool param
val string_list : string list -> Dbcaml.Params.t
List of strings param
val number_list : int list -> Dbcaml.Params.t
List of numbers param
module type Intf = sig ... end
type t =
| Ready_to_connect of {
driver : (module Intf);
connections : int;
connection_string : string;
}
| Connected of {
driver : Dbcaml.Driver.t;
connections : int;
connection_string : string;
conn_mgr_pid : Riot.Pid.t;
}
Create a new config based on the provided params.
Start a connection to the database. This spins up a pool and creates the amount of connections provided in the config
val query :
?params:Dbcaml.Params.t list ->
t ->
query:string ->
deserializer:'a Serde.De.t ->
('b option, string) Stdlib.result
Query send a fetch request to the database and use the bytes to deserialize the output to a type using serde. Ideal to use for select queries
Used internally. parse_command_complete reads the "Command Complete" message which starts with a C and reads how many rows that is effected and return a int If it's unable to do so do it return a error
val execute :
?params:Dbcaml.Params.t list ->
t ->
query:string ->
(int, string) Stdlib.result
Execute sends a execute command to the database and returns the amount of rows affected. Ideal to use for insert,update and delete queries