This commit is contained in:
parent
e9b7142412
commit
bb1431251c
1 changed files with 8 additions and 5 deletions
13
src/pg.ml
13
src/pg.ml
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue