Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct { UID string `json:"uid"` Currency string `json:"currency"` Balance float64 `json:"balance"` CreatedAt time.Time `json:"created_at"` }
Account define account description
type AccountBuilder ¶
type AccountBuilder interface { // SetUID initializes UID for the new account SetUID(uid string) AccountBuilder // SetBalance initializes initial balance for the new account SetBalance(balance float64) AccountBuilder // SetCurrency initializes currency for the new account SetCurrency(currency string) AccountBuilder // Build actually creates new account Build(ctx context.Context) (*Account, error) }
AccountBuilder declare interface to build new account
type AccountManager ¶
type AccountManager interface { // AllAccounts return all available accounts in the system AllAccounts(ctx context.Context) ([]Account, error) // AllPayments return all available payments in the system AllPayments(ctx context.Context) ([]Payment, error) // AccountBuilder instantiate new account builder AccountBuilder() AccountBuilder // PaymentBuilder instantiate new payment builder PaymentBuilder() PaymentBuilder }
AccountFactory declare interface to access accounts and payments information (kind of facade to simplify interface)
type AccountRequest ¶
type AccountRequest struct { UID string `json:"uid"` Currency string `json:"currency"` Balance float64 `json:"balance"` }
AccountRequest define request to create new account
type Error ¶
type Error struct { Kind ErrorKind // contains filtered or unexported fields }
Error define custom handler error
type Payment ¶
type Payment struct { UID string `json:"account"` SourceUID *string `json:"from_account,omitempty"` TargetUID *string `json:"to_account,omitempty"` Direction string `json:"direction"` Amount float64 `json:"amount"` CreatedAt time.Time `json:"created_at"` }
Payment define payment description
type PaymentBuilder ¶
type PaymentBuilder interface { // SetAmount initializes amount for the new payment SetAmount(amount float64) PaymentBuilder // SetPayer initializes payer for the new payment SetPayer(uid string) PaymentBuilder // SetRecipient initializes recipient for the new payment SetRecipient(uid string) PaymentBuilder // Build actually creates new payment Build(ctx context.Context) (*Payment, error) }
PaymentBuilder declare interface to build new payment
type PaymentRequest ¶
type PaymentRequest struct { RecipientUID string `json:"recipient"` Amount float64 `json:"amount"` }
PaymentRequest define request to create new payment
type ServerStatusResponse ¶
type ServerStatusResponse struct { IsAlive bool `json:"is_alive"` BuildTime string `json:"build_time"` Version string `json:"version"` }
ServerStatusResponse declare response for status request
Click to show internal directories.
Click to hide internal directories.