summaryrefslogtreecommitdiff
path: root/lib/model/content.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 /lib/model/content.ml
parent7087a0c2c84e796e474784cbd28d4a4e574cf2c0 (diff)
Securized the queries in the database with a dedicated type for the Identifiers
Diffstat (limited to 'lib/model/content.ml')
-rw-r--r--lib/model/content.ml7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/model/content.ml b/lib/model/content.ml
index 4fe8e92..7b9d9a4 100644
--- a/lib/model/content.ml
+++ b/lib/model/content.ml
@@ -1,13 +1,13 @@
open StdLabels
type 'a t = {
- id : string;
+ id : Identifier.t;
sections : 'a Section.t list;
subcontents : 'a t list;
parent : 'a t Weak.t;
}
-let v : string -> 'a Section.t list -> 'a t list -> 'a t =
+let v : Identifier.t -> 'a Section.t list -> 'a t list -> 'a t =
fun id sections subcontents ->
let parent = Weak.create 1 in
let content = { id; sections; subcontents; parent } in
@@ -32,7 +32,8 @@ let fields : 'a t -> 'a Field.t Seq.t =
let find_target : 'a t -> string -> 'a option =
fun t name ->
let feature_opt =
- Seq.find (fun f -> String.equal (Field.name f) name) (fields t)
+ Seq.find (fun f -> String.equal (Identifier.to_string (Field.name f)) name)
+ (fields t)
in
let ( let* ) = Option.bind in