This commit is contained in:
swrup 2025-12-07 01:51:07 +01:00
parent e9b7142412
commit bb1431251c

View file

@ -12,11 +12,14 @@ module Caqti_type = struct
let amount : Amount.t t = let amount : Amount.t t =
let open Amount in let open Amount in
custom let intro value fraction =
~encode:(fun amount -> Ok (amount.value, amount.fraction)) match make ~sign:None ~currency:Config.currency ~value ~fraction with
~decode:(fun (value, fraction) -> | Error e -> raise (Caqti_type.Reject e)
Amount.make ~sign:None ~currency:Config.currency ~value ~fraction) | Ok v -> v
(t2 int64 int32) in
let p1 t = t.value in
let p2 t = t.fraction in
product intro @@ proj int64 p1 @@ proj int32 p2 @@ proj_end
let age_mask : int t = Caqti_type.int let age_mask : int t = Caqti_type.int