add result.ml; polymorphic variant errors + refacto
This commit is contained in:
parent
9fd3b5a3cc
commit
42b0ec1445
36 changed files with 949 additions and 954 deletions
|
|
@ -1,24 +1,18 @@
|
|||
(* this module defines caqti encoding/decodings *)
|
||||
open Caqti_type
|
||||
open Time
|
||||
open Api
|
||||
|
||||
let amount : Amount.t t =
|
||||
let open Amount in
|
||||
custom
|
||||
~encode:(fun amount -> Ok (amount.value, amount.fraction))
|
||||
~decode:(fun (value, fraction) ->
|
||||
Amount.make ~sign:None ~currency:Config.currency ~value ~fraction)
|
||||
(t2 int64 int32)
|
||||
|
||||
(* we want to use int64 timestamps,
|
||||
not postgresql built-in timestamp type *)
|
||||
let ptime : unit t = Caqti_type.unit
|
||||
let time = Time.Timestamp.caqti
|
||||
let time_span = Time.TimeRelative.caqti
|
||||
let time = Timestamp.caqti
|
||||
let time_span = TimeRelative.caqti
|
||||
let age_mask : int t = Caqti_type.int
|
||||
let rsa_pub = Rsa.pub_caqti
|
||||
let eddsa_pub = Eddsa.pub_caqti
|
||||
let eddsa_sig = Eddsa.sig_caqti
|
||||
let amount : Amount.t t = Amount.caqti ~currency:Config.currency
|
||||
|
||||
(* todo: enum type for wire_method? *)
|
||||
let wire_method = Caqti_type.string
|
||||
|
|
@ -119,10 +113,10 @@ let denom =
|
|||
(t2 denom_hash master_sig))
|
||||
|
||||
let account_restrictions =
|
||||
custom
|
||||
~encode:(fun l -> Api.encode (Jsont.list AccountRestriction.jsont) l)
|
||||
~decode:(fun s -> Api.decode (Jsont.list AccountRestriction.jsont) s)
|
||||
string
|
||||
let jsont = Jsont.list Api.AccountRestriction.jsont in
|
||||
let encode = Api.encode' jsont in
|
||||
let decode = Api.decode' jsont in
|
||||
custom ~encode ~decode string
|
||||
|
||||
let global_fee =
|
||||
let master_sig = Signatures.GlobalFees.caqti in
|
||||
|
|
@ -355,7 +349,7 @@ module Auditor = struct
|
|||
auditor_pub: Eddsa.pub;
|
||||
auditor_url: string;
|
||||
auditor_name: string;
|
||||
last_change: Time.Timestamp.t;
|
||||
last_change: Timestamp.t;
|
||||
is_active: bool;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue