summaryrefslogtreecommitdiff
path: root/lib/query/encoder.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-03-30 17:56:42 +0200
committerSébastien Dailly <sebastien@dailly.me>2026-04-01 09:49:08 +0200
commit4af7d2f6ff8b38365c97a89c295710f5ed3266f5 (patch)
tree8b641d4992eac896223c5169a8b7301205685d85 /lib/query/encoder.ml
parent830e7c5d27d161b91402414e6ecd49f1ed818bfb (diff)
Manage insertion for multireferences fields
Diffstat (limited to 'lib/query/encoder.ml')
-rw-r--r--lib/query/encoder.ml25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/query/encoder.ml b/lib/query/encoder.ml
index 624931a..2f86eab 100644
--- a/lib/query/encoder.ml
+++ b/lib/query/encoder.ml
@@ -203,10 +203,11 @@ module CaqtiRequest = Map (struct
let t_n = Caqti_type.t11
let f : type a. a data -> a Caqti_type.t = function
- | { content = Text; _ } -> Caqti_type.option @@ Caqti_type.string
- | { content = Integer; _ } -> Caqti_type.option @@ Caqti_type.int64
- | { content = MultiReference _; _ } -> Caqti_type.option @@ Caqti_type.int64
- | { content = MonoReference _; _ } -> Caqti_type.option @@ Caqti_type.int64
+ | { content_type = Text; _ } -> Caqti_type.option @@ Caqti_type.string
+ | { content_type = Integer; _ } -> Caqti_type.option @@ Caqti_type.int64
+ | { content_type = MultiReference _; _ } -> Caqti_type.int64
+ | { content_type = MonoReference _; _ } ->
+ Caqti_type.option @@ Caqti_type.int64
end)
module DefaultEncoder = struct
@@ -246,10 +247,10 @@ module EncodeInsert = Map (struct
type 'a t = string
let f : type a. a data -> a t = function
- | { content = Text; _ } -> "?"
- | { content = Integer; _ } -> "?"
- | { content = MonoReference _; _ } -> "?"
- | { content = MultiReference _; _ } ->
+ | { content_type = Text; _ } -> "?"
+ | { content_type = Integer; _ } -> "?"
+ | { content_type = MonoReference _; _ } -> "?"
+ | { content_type = MultiReference _; _ } ->
failwith "Cannot encode multireference field"
include ConcatParam
@@ -259,10 +260,10 @@ module InsertTableName = Map (struct
type 'a t = string
let f : type a. a data -> a t = function
- | { name = column; content = Text; _ } -> column
- | { name = column; content = Integer; _ } -> column
- | { name = column; content = MultiReference _; _ } -> column
- | { name = column; content = MonoReference _; _ } -> column
+ | { name = column; content_type = Text; _ } -> column
+ | { name = column; content_type = Integer; _ } -> column
+ | { name = column; content_type = MultiReference _; _ } -> column
+ | { name = column; content_type = MonoReference _; _ } -> column
include ConcatParam
end)