Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (55 sloc) 2.39 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 Task : sig
type t = <
id : int64 option;
set_id : int64 option -> unit;
name : string;
set_name : string -> unit;
started : float;
set_started : float -> unit;
time_taken : float;
set_time_taken : float -> unit;
exit_code : int64;
set_exit_code : int64 -> 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 ->
name:string ->
started:float ->
time_taken:float ->
exit_code:int64 ->
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 ->
?name:string option ->
?started:float option ->
?time_taken:float option ->
?exit_code:int64 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
*)
end