summaryrefslogtreecommitdiff
path: root/lib/query/insert.mli
blob: d3e3de94b5faed9c4b3f67739c8c4b0ad38f527f (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
(** Low level insertion in the database *)

val insert :
  Caqti_lwt.connection ->
  Model.content ->
  ?parent:Int64.t ->
  (string -> Model.target Model.Data.any) ->
  int64 Lwt.t
(** See [Query.insert] *)

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 to get its
    value, like [insert]. Multivalued fields are inserted in their dedicated
    table, with the parent pointing to the inserted list row. *)

val insert_references :
  Caqti_lwt.connection ->
  Model.content ->
  Int64.t ->
  Model.Identifier.t ->
  Model.target Model.Data.any ->
  (Int64.t, _) Intf.data ->
  unit Lwt.t
(** Insert a list of references for a content. This function is used during the
    update but is not exposed outside of the module *)