caqti amount: shorter syntax for output param

This commit is contained in:
swrup 2025-12-07 16:39:12 +01:00
parent 32fa5b1fc3
commit 699e46c003

View file

@ -7,7 +7,10 @@
GNU Taler db-events? GNU Taler db-events?
it seems caqti/pgx does not support it *) it seems caqti/pgx does not support it *)
module type CONN = Caqti_miou.CONNECTION
open Crypto open Crypto
open Bin_type
module Caqti_type = struct module Caqti_type = struct
include Caqti_type include Caqti_type
@ -31,7 +34,6 @@ module Caqti_type = struct
include struct include struct
(* alias for hash *) (* alias for hash *)
open Bin_type
let fullpayto_hash = FullPaytoHash.caqti let fullpayto_hash = FullPaytoHash.caqti
let nomalizaedpayto_hash = NormalizedPaytoHash.caqti let nomalizaedpayto_hash = NormalizedPaytoHash.caqti
@ -49,10 +51,6 @@ module Caqti_type = struct
include Caqti_request.Infix include Caqti_request.Infix
end end
module type CONN = Caqti_miou.CONNECTION
open Bin_type
let preflight = let preflight =
let l = let l =
List.map List.map
@ -66,8 +64,7 @@ let preflight =
"SET search_path TO exchange;"; "SET search_path TO exchange;";
] ]
in in
fun (module Conn : Caqti_miou.CONNECTION) -> fun (module Conn : CONN) -> Syntax.list_iter (fun p -> Conn.exec p ()) l
Syntax.list_iter (fun p -> Conn.exec p ()) l
let lookup_signing_key = let lookup_signing_key =
let lookup_signing_key = let lookup_signing_key =
@ -107,10 +104,8 @@ let lookup_denomination_key =
denomination_hash denomination_hash
->? t10 time time time time amount amount amount amount amount age_mask) ->? t10 time time time time amount amount amount amount amount age_mask)
"SELECT valid_from, expire_withdraw, expire_deposit, expire_legal, \ "SELECT valid_from, expire_withdraw, expire_deposit, expire_legal, \
(coin).val, (coin).frac, (fee_withdraw).val, (fee_withdraw).frac, \ (coin).*, (fee_withdraw).*, (fee_deposit).*, (fee_refresh).*, \
(fee_deposit).val, (fee_deposit).frac, (fee_refresh).val, \ (fee_refund).*, age_mask FROM denominations WHERE denom_pub_hash=$1"
(fee_refresh).frac, (fee_refund).val, (fee_refund).frac, age_mask FROM \
denominations WHERE denom_pub_hash=$1"
in in
fun (module Conn : CONN) (h_denom_pub : DenominationHash.t) -> fun (module Conn : CONN) (h_denom_pub : DenominationHash.t) ->
Conn.find_opt lookup_denomination_key h_denom_pub Conn.find_opt lookup_denomination_key h_denom_pub