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