From 4af7d2f6ff8b38365c97a89c295710f5ed3266f5 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 30 Mar 2026 17:56:42 +0200 Subject: Manage insertion for multireferences fields --- lib/query/encoder.ml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib/query/encoder.ml') 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) -- cgit v1.2.3