summaryrefslogtreecommitdiff
path: root/test/insert.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-18 20:24:52 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-18 21:57:48 +0100
commit62123e577ee5d4066d53f8ad7e5ac3d2eb190430 (patch)
treef569686630681a9eceb2685f69b55fe5a2bac17c /test/insert.ml
parent7087a0c2c84e796e474784cbd28d4a4e574cf2c0 (diff)
Securized the queries in the database with a dedicated type for the Identifiers
Diffstat (limited to 'test/insert.ml')
-rw-r--r--test/insert.ml6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/insert.ml b/test/insert.ml
index bc65422..451d857 100644
--- a/test/insert.ml
+++ b/test/insert.ml
@@ -35,7 +35,7 @@ let insert_and_get_result :
Query.insert ?parent db content (fun v ->
match List.assoc_opt v entry with Some v -> v | None -> Model.Typ.None)
in
- let content_id = Model.Content.id content in
+ let content_id = Model.Identifier.to_string (Model.Content.id content) in
let module Db = (val db) in
let* json_result = Db.find (Common.content_as_json content) id in
let* json = Caqti_lwt.or_fail json_result in
@@ -144,7 +144,7 @@ module Make (S : Decoders.Decode.S) = struct
[
( "content",
fun v ->
- match (Configuration.Ast.get_content conf) key with
+ match (Configuration.Ast.get_content conf) (Model.Identifier.of_string key) with
| None -> Error (Decoders.Error.make "no content")
| Some subcontent ->
let values = self#values subcontent v in
@@ -172,7 +172,7 @@ module Make (S : Decoders.Decode.S) = struct
fun name ->
(* In this syntax, the content is supposed to follow the definition
and will never be None *)
- let content = Configuration.Ast.get_content conf name |> Option.get in
+ let content = Configuration.Ast.get_content conf (Model.Identifier.of_string name) |> Option.get in
let* properties =
S.field_opt_or ~default:(Lwt.return []) "values"
(self#values content)