Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLStore ¶
type SQLStore struct { *Queries // contains filtered or unexported fields }
Store provides all functions to SQL queries and transactions
func (*SQLStore) TransferTx ¶
func (store *SQLStore) TransferTx(ctx context.Context, arg TransferTxParams) (TransferTxResult, error)
TransferTx performs a money transfer from one account to the other. It created a transfer record, add account entries, and, update accounts balance within a single database transaction
type Store ¶
type Store interface {
Querier
TransferTx(ctx context.Context, arg TransferTxParams) (TransferTxResult, error)
}
Store provides all functions to execute queries and transactions
type TransferTxParams ¶
type TransferTxParams struct { FromAccountID int64 `json:"from_account_id"` ToAccountID int64 `json:"to_account_id"` Amount int64 `json:"amount"` }
TransferTxParams contains input parameters of the transfer transaction
type TransferTxResult ¶
type TransferTxResult struct { Transfer Transfer `json:"transfer"` FromAccount Account `json:"from_account"` ToAccount Account `json:"to_account"` FromEntry Entry `json:"from_entry"` ToEntry Entry `json:"to_entry"` }
TransferTxResult contains the result of the transfer transaction
Click to show internal directories.
Click to hide internal directories.