diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-11-20 16:23:53 +0100 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-11-20 16:23:53 +0100 |
| commit | b05e2d2be7be28ee6c577671002797cf9abaf177 (patch) | |
| tree | 0474684d619721024f0a6cb132cf2f4d2e84c344 /lib/query/query.mli | |
| parent | c4ca180fd7c2085e3ce3f8e32aa0c2cb724f4c53 (diff) | |
New module for working with Values
Diffstat (limited to 'lib/query/query.mli')
| -rw-r--r-- | lib/query/query.mli | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/query/query.mli b/lib/query/query.mli index d4badd5..cd7287f 100644 --- a/lib/query/query.mli +++ b/lib/query/query.mli @@ -1,16 +1,17 @@ val insert : Caqti_lwt.connection -> Model.content -> - ?parent:int64 -> - (string -> Model.value) -> - int64 Lwt.t -(** Insert a new element and return the ID. + ?parent:Model.content Value.t -> + (string -> Value.value) -> + Model.content Value.t Lwt.t +(** Insert a new element and return it as a value. - [insert db content ~parent provider] will create the content in the - database. + [insert db content ~parent provider] will create the content in the database + and return the inserted row as a [Value.t] (the content together with its + new id). - The parent is required if the content is a subcontent. Not providing the - parameter will raise the error [TypeMismatch]. + The parent — itself a value — 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 @@ -22,13 +23,14 @@ val insert : val insert_list : Caqti_lwt.connection -> Model.list -> - (string -> Model.value) -> - int64 Lwt.t -(** Insert a row in the dedicated table of a static list, and return its id. + (string -> Value.value) -> + Model.list Value.t Lwt.t +(** Insert a row in the dedicated table of a static list, and return it as a + value. 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. *) + [insert]. This is the function used to populate the lists from their source. +*) val create : Caqti_lwt.connection -> Configuration.Ast.setting -> unit Lwt.t @@ -36,5 +38,5 @@ val update : Caqti_lwt.connection -> Int64.t -> Model.content -> - (string -> Model.value) -> + (string -> Value.value) -> unit Lwt.t |
