Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct {
ID string `json:"id"`
Balances map[Currency]float64 `json:"balances,omitempty"`
}
Account represents id holding multiple currencies
func (*Account) AppendBalance ¶
AppendBalance adds or removes from account balance for given currency
func (*Account) BalanceFor ¶
BalanceFor returns amount for given currency
func (*Account) SetBalance ¶
SetBalance hard reset balance for given currency
type Repository ¶
type Repository interface {
Store(*Account) error
Find(id string) (*Account, error)
FindAll() []*Account
}
Repository provides access a account store.
type Service ¶
type Service interface {
// CreateAccount creates new account with generated ID
CreateAccount() (*Account, error)
// GetAccount returns account by ID
GetAccount(string) (*Account, error)
// Accounts lists all accounts
Accounts() []*Account
// SetBalanceForAccount hard reset balance for account for given currency
SetBalanceForAccount(*Account, Currency, float64) (*Account, error)
}
Service is the interface that provides account methods.
Click to show internal directories.
Click to hide internal directories.