(* TODO be sure to not use postgres ptime add a dune stanza like for prelude: "(flags (:standard -open Prelude))" *) module Caqti_type = struct include Caqti_type (* we want to use int64 timestamps, not postgresql built-in timestamp type *) let ptime : Ptime.t Caqti_type.t = let encode i = Ok (Util.ptime_to_int64 i) in let decode = Util.ptime_of_int64 in Caqti_type.custom ~encode ~decode Caqti_type.(int64) end let pg_amount : Amount.t Caqti_type.t = let open Amount in Caqti_type.custom ~encode:(fun amount -> Ok (amount.value, amount.fraction)) ~decode:(fun (value, fraction) -> Amount.make ~sign:None ~currency:Config.currency ~value ~fraction) Caqti_type.(t2 int64 int32) (* WIP: minimum db functions for basic /management *) let pg_todo () = assert false (* signkey *) (* todo: - what type to use for TALER_ExchangePublicKeyP + TALER_EXCHANGEDB_SignkeyMetaData -> I think it could be something = to FutureSignKey.t - master signature: over smthing? *) let activate_signing_key _cls _exchange_public_key _master_signature = pg_todo (* enum GNUNET_DB_QueryStatus TEH_PG_activate_signing_key ( void *cls, const struct TALER_ExchangePublicKeyP *exchange_pub, const struct TALER_EXCHANGEDB_SignkeyMetaData *meta, const struct TALER_MasterSignatureP *master_sig) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam iparams[] = { GNUNET_PQ_query_param_auto_from_type (exchange_pub), GNUNET_PQ_query_param_timestamp (&meta->start), GNUNET_PQ_query_param_timestamp (&meta->expire_sign), GNUNET_PQ_query_param_timestamp (&meta->expire_legal), GNUNET_PQ_query_param_auto_from_type (master_sig), GNUNET_PQ_query_param_end }; PREPARE (pg, "insert_signkey", "INSERT INTO exchange_sign_keys " "(exchange_pub" ",valid_from" ",expire_sign" ",expire_legal" ",master_sig" ") VALUES " "($1, $2, $3, $4, $5);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_signkey", iparams); } *) (* ----- *) let lookup_signing_key = pg_todo let iterate_active_signkeys = pg_todo let insert_signkey_revocation = pg_todo let lookup_signkey_revocation = pg_todo (* denominations *) let insert_denomination_info = pg_todo let get_denomination_info = pg_todo let get_denomination_by_serial = pg_todo let iterate_denomination_info = pg_todo let iterate_denominations = pg_todo let get_coin_denomination = pg_todo let insert_denomination_revocation = pg_todo let get_denomination_revocation = pg_todo let lookup_denomination_key = pg_todo let add_denomination_key = pg_todo