blob: 5e42f091af470b1cbf6715fd90c7ed8685fe78ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
val insert :
Caqti_lwt.connection ->
Model.content ->
?parent:Int64.t ->
(string -> Model.target Model.Data.any) ->
int64 Lwt.t
(** Insert a new element in the database and return the id of the new row.
[insert db content ~parent provider] creates the content in the database and
returns the primary key of the inserted row.
The [parent] — the id of the parent row — is required if the content is a
subcontent. Not providing the parameter will raise the error [TypeMismatch].
For each field in the content, the function [provider] will be called with
the name for this property. The value returned shall match the expected type
for this property, the exception [TypeMismatch] is raised otherwise.
This is a low-level function: there is no representation for the content
itself, and no functionnals controls are realized. *)
val insert_list :
Caqti_lwt.connection ->
Model.list ->
(string -> Model.target Model.Data.any) ->
int64 Lwt.t
(** Insert a row in the dedicated table of a static list, and return its id.
The [provider] is called with the name of each field of the list, like
[insert]. This is the function used to populate the lists from their source.
*)
val create : Caqti_lwt.connection -> Configuration.Ast.setting -> unit Lwt.t
val update :
Caqti_lwt.connection ->
Int64.t ->
Model.content ->
(string -> Model.target Model.Data.any) ->
unit Lwt.t
val select :
Caqti_lwt.connection ->
Int64.t ->
Model.content ->
Select.callback ->
unit Lwt.t
(** Read a row of a content table and call the callback once per field with the
field's named type and its value. See [Query.Select.select] *)
val select_list :
Caqti_lwt.connection -> Int64.t -> Model.list -> Select.callback -> unit Lwt.t
(** Read a row of a list table and call the callback once per field with the
field's named type and its value. See [Query.Select.select_list] *)
|