add timestamp.ml
WIP better time revert this?
This commit is contained in:
parent
d760a54b61
commit
d7d302bafa
10 changed files with 143 additions and 142 deletions
15
src/pg.ml
15
src/pg.ml
|
|
@ -7,10 +7,8 @@ module Caqti_type = struct
|
|||
"(flags (:standard -open Prelude))" *)
|
||||
(* we want to use int64 timestamps,
|
||||
not postgresql built-in timestamp type *)
|
||||
let ptime : Ptime.t t =
|
||||
let encode i = Ok (Util.ptime_to_int64 i) in
|
||||
let decode = Util.ptime_of_int64 in
|
||||
custom ~encode ~decode int64
|
||||
let ptime : Ptime.t option t = Timestamp.caqti
|
||||
let time = Timestamp.caqti
|
||||
|
||||
let amount : Amount.t t =
|
||||
let open Amount in
|
||||
|
|
@ -82,7 +80,7 @@ let preflight =
|
|||
|
||||
let lookup_signing_key =
|
||||
let lookup_signing_key =
|
||||
Caqti_type.(eddsa_public ->? t3 ptime ptime ptime)
|
||||
Caqti_type.(eddsa_public ->? t3 time time time)
|
||||
"SELECT valid_from, expire_sign, expire_legal FROM exchange_sign_keys \
|
||||
WHERE exchange_pub=$1"
|
||||
in
|
||||
|
|
@ -91,7 +89,7 @@ let lookup_signing_key =
|
|||
|
||||
let activate_signing_key =
|
||||
let insert_signkey =
|
||||
Caqti_type.(t5 eddsa_public ptime ptime ptime eddsa_signature ->. unit)
|
||||
Caqti_type.(t5 eddsa_public time time time eddsa_signature ->. unit)
|
||||
"INSERT INTO exchange_sign_keys (exchange_pub, valid_from, expire_sign, \
|
||||
expire_legal, master_sig) VALUES ($1, $2, $3, $4, $5)"
|
||||
in
|
||||
|
|
@ -107,8 +105,7 @@ let lookup_denomination_key =
|
|||
let lookup_denomination_key =
|
||||
Caqti_type.(
|
||||
denomination_hash
|
||||
->? t10 ptime ptime ptime ptime 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, coin, \
|
||||
fee_withdraw, fee_deposit, fee_refresh, fee_refund, age_mask FROM \
|
||||
denominations WHERE denom_pub_hash=$1"
|
||||
|
|
@ -119,7 +116,7 @@ let lookup_denomination_key =
|
|||
let add_denomination_key =
|
||||
let denomination_insert =
|
||||
Caqti_type.(
|
||||
t12 denomination_hash rsa_public eddsa_signature ptime ptime ptime ptime
|
||||
t12 denomination_hash rsa_public eddsa_signature time time time time
|
||||
amount amount amount amount (t2 amount age_mask)
|
||||
->. unit)
|
||||
"INSERT INTO denominations (denom_pub_hash, denom_pub, master_sig, \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue