Repodb_mariadb
repodb-mariadb · API reference
val default_cache_size : intMariaDB/MySQL driver for Repodb.
This package exposes a concrete Repodb.Driver.S implementation backed by the blocking MariaDB bindings. It targets MariaDB/MySQL deployments while keeping the same Repodb API used by the SQLite and PostgreSQL drivers.
Basic use:
module Repo = Repodb.Repo.Make (Repodb_mariadb.Driver)
let conninfo =
"host=localhost port=3306 user=app password=secret dbname=app"
let result =
Repodb_mariadb.with_connection conninfo (fun conn ->
Repo.all_query conn (Repodb.Query.from User.table) ~decode:decode_user)Connection info is a whitespace-separated list of key=value pairs. The accepted keys are host, port, user or username, password or pass, db, dbname, database, socket or unix_socket, and charset. Values may be quoted with single or double quotes.
MariaDB does not support every PostgreSQL-oriented feature. In particular, RETURNING support is reported as unavailable and some JSON operations use MySQL JSON functions rather than PostgreSQL operators. Prefer the Query and Expr builders so dialect differences are handled centrally.
module Raw : sig ... endmodule Driver : sig ... endtype connection = Driver.connectiontype error = Driver.errorval dialect : Repodb.Driver.dialectval error_message : Driver.error -> stringval connect : string -> (Driver.connection, Driver.error) resultval close : Driver.connection -> unitval with_connection :
string ->
(Driver.connection -> ('a, Driver.error) result) ->
('a, Driver.error) resultval exec :
Driver.connection ->
string ->
params:Repodb.Driver.Value.t array ->
(unit, Driver.error) resultval query :
Driver.connection ->
string ->
params:Repodb.Driver.Value.t array ->
(Repodb.Driver.row list, Driver.error) resultval query_one :
Driver.connection ->
string ->
params:Repodb.Driver.Value.t array ->
(Repodb.Driver.row option, Driver.error) resultval query_fold :
Driver.connection ->
string ->
params:Repodb.Driver.Value.t array ->
init:'a ->
f:('a -> Repodb.Driver.row -> 'a) ->
('a, Driver.error) resultval query_iter :
Driver.connection ->
string ->
params:Repodb.Driver.Value.t array ->
f:(Repodb.Driver.row -> unit) ->
(unit, Driver.error) resultval transaction :
Driver.connection ->
(Driver.connection -> ('a, Driver.error) result) ->
('a, Driver.error) resultval placeholder : int -> stringval returning_supported : boolval upsert_syntax : [ `PostgreSQL | `SQLite | `Standard ]val last_insert_id : Driver.connection -> (int64, Driver.error) resultval driver : Repodb.Driver.driver