Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("client not found") ErrInvalidArgument = errors.New("client invalid argument") ErrInternal = errors.New("client internal error") ErrTransactionDenied = errors.New("client transaction denied") )
Set of errors for client API.
Functions ¶
This section is empty.
Types ¶
type Billing ¶
type Billing struct { Balance int Limit int Date time.Time LastTransactions []Transaction }
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core deals with client's business logic.
func (*Core) AddTransaction ¶
type NewTransaction ¶
type Store ¶
type Store interface { // ExecUnderTx executes the fn function under a transaction. If fn returns // an error the transaction is rolled back and the error is returned. ExecUnderTx(ctx context.Context, fn func(tx Store) error) error // QueryByID returns information about a client. QueryByID(ctx context.Context, clientID int) (Client, error) // QueryTransactions returns the most recent client's transactions. QueryTransactions(ctx context.Context, clientID, pageNumber, rowsPerPage int) ([]Transaction, error) // AddTransaction add a transaction associated with a client. AddTransaction(ctx context.Context, t Transaction) error UpdateClientBalance(ctx context.Context, clientID, balance int) (Client, error) }
Store is used to persist client's data.
Click to show internal directories.
Click to hide internal directories.