change ptime util; amount fraction to int32
This commit is contained in:
parent
2433ff3932
commit
f278048faa
3 changed files with 16 additions and 11 deletions
|
|
@ -14,11 +14,9 @@ end
|
|||
|
||||
let pg_amount : Amount.t Caqti_type.t =
|
||||
let open Amount in
|
||||
(* TODO bad int32 conversion *)
|
||||
Caqti_type.custom
|
||||
~encode:(fun amount -> Ok (amount.value, Int64.to_int32 amount.fraction))
|
||||
~encode:(fun amount -> Ok (amount.value, amount.fraction))
|
||||
~decode:(fun (value, fraction) ->
|
||||
let fraction = Int64.of_int32 fraction in
|
||||
Ok { sign= None; currency= `Eur; value; fraction })
|
||||
Caqti_type.(t2 int64 int32)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue