Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (64 sloc) 2.65 KB
(* autogenerated by sql_orm *)
(** Use the [[Init]] module to open a new database handle. Each object type has its own module with functions to create, modify, save and destroy objects of that type into the SQLite database
*)
module Init : sig
type t
type transaction_mode = [`Exclusive |`Deferred |`Immediate ]
(** Database handle which can be used to create and retrieve objects
*)
val t :
?busyfn:(Sqlite3.db -> unit) -> ?mode:transaction_mode ->
string -> t
(** [t db_name] open a Sqlite3 database with filename [db_name] and create any tables if they are missing. @return a database handle which can be used to create and retrieve objects in the database.
@raise Sql_error if a database error is encountered
*)
val db: t -> Sqlite3.db
(** [db handle] @return the underlying Sqlite3 database handle for the connection, for advanced queries.
*)
end
module Passwd : sig
type t = <
id : int64 option;
set_id : int64 option -> unit;
service : string;
set_service : string -> unit;
ctime : float;
set_ctime : float -> unit;
username : string;
set_username : string -> unit;
encpasswd : string;
set_encpasswd : string -> unit;
comment : string;
set_comment : string -> unit;
save: int64; delete: unit
>
(** An object which can be stored in the database with the [save] method call, or removed by calling [delete]. Fields can be accessed via the approriate named method and set via the [set_] methods. Changes are not committed to the database until [save] is invoked.
*)
val t :
?id:int64 option ->
service:string ->
ctime:float ->
username:string ->
encpasswd:string ->
comment:string ->
Init.t -> t
(** Can be used to construct a new object. If [id] is not specified, it will be automatically assigned the first time [save] is called on the object. The object is not committed to the database until [save] is invoked. The [save] method will also return the [id] assigned to the object.
@raise Sql_error if a database error is encountered
*)
val get :
?id:int64 option ->
?service:string option ->
?ctime:float option ->
?username:string option ->
?encpasswd:string option ->
?comment:string option ->
?custom_where:string * Sqlite3.Data.t list -> Init.t -> t list
(** Used to retrieve objects from the database. If an argument is specified, it is included in the search criteria (all fields are ANDed together).
@raise Sql_error if a database error is encountered
*)
val get_by_service_username :
service:string ->
username:string ->
?custom_where:string * Sqlite3.Data.t list -> Init.t ->
t list
end