Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAccountAlreadyExists is an error when creating an account that already exists ErrAccountAlreadyExists = errors.New("account already exists") // ErrAccountNotFound is an error when retrieving an account that doesn't exists ErrAccountNotFound = errors.New("account not found") // ErrValidation is an account related validation error ErrValidation = errors.New("validation error") )
List of account related errors
Functions ¶
Types ¶
type Account ¶
type Account struct { AccountID AccountID `json:"id"` Currency currency.Currency `json:"currency"` Balance decimal.Decimal `json:"balance"` }
Account is an external account. These accounts are usually debit accounts.
type Balance ¶
type Balance struct { AccountID AccountID TotalCredit decimal.Decimal TotalDebit decimal.Decimal CurrentBal decimal.Decimal Ts *time.Time }
Balance is an account balance
type Repository ¶
type Repository interface { // CreateAccount creates an account CreateAccount(context.Context, Account) (AccountID, error) // GetAccount retrieves the account GetAccount(context.Context, AccountID) (*Account, error) // IsAccountExists returns true if the account exists IsAccountExists(context.Context, AccountID) (bool, error) // ListAccounts retrieves the list of accounts ListAccounts(context.Context) ([]*Account, error) }
Repository is an account repository
type Service ¶
type Service interface { // CreateAccount creates an account CreateAccount(context.Context, Account) error // GetAccount retrieives an account via AccountID GetAccount(context.Context, AccountID) (*Account, error) // ListAccounts retrieives the list of accounts ListAccounts(context.Context) ([]*Account, error) }
Service is an account service
Source Files ¶
Click to show internal directories.
Click to hide internal directories.