Documentation ¶
Index ¶
- type Accounts
- type AddAccountBalanceParams
- type CreateAccountParams
- type CreateEntryParams
- type CreateSessionParams
- type CreateTransferParams
- type CreateUserParams
- type DBTX
- type Entries
- type ListAccountsParams
- type ListEntriesParams
- type Querier
- type Queries
- func (q *Queries) AddAccountBalance(ctx context.Context, arg AddAccountBalanceParams) (Accounts, error)
- func (q *Queries) CreateAccount(ctx context.Context, arg CreateAccountParams) (Accounts, error)
- func (q *Queries) CreateEntry(ctx context.Context, arg CreateEntryParams) (Entries, error)
- func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Sessions, error)
- func (q *Queries) CreateTransfer(ctx context.Context, arg CreateTransferParams) (Transfer, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (Users, error)
- func (q *Queries) DeleteAccount(ctx context.Context, id int64) error
- func (q *Queries) GetAccount(ctx context.Context, id int64) (Accounts, error)
- func (q *Queries) GetAccountForUpdate(ctx context.Context, id int64) (Accounts, error)
- func (q *Queries) GetEntry(ctx context.Context, id int64) (Entries, error)
- func (q *Queries) GetSession(ctx context.Context, username string) (Sessions, error)
- func (q *Queries) GetTransfer(ctx context.Context, id int64) (Transfer, error)
- func (q *Queries) GetUser(ctx context.Context, username string) (Users, error)
- func (q *Queries) ListAccounts(ctx context.Context, arg ListAccountsParams) ([]Accounts, error)
- func (q *Queries) ListEntries(ctx context.Context, arg ListEntriesParams) ([]Entries, error)
- func (q *Queries) TransferList(ctx context.Context, arg TransferListParams) ([]Transfer, error)
- func (q *Queries) UpdateAccount(ctx context.Context, arg UpdateAccountParams) (Accounts, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type SQLStore
- type Sessions
- type Store
- type Transfer
- type TransferListParams
- type TransferTxParams
- type TransferTxResult
- type UpdateAccountParams
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddAccountBalanceParams ¶
type CreateAccountParams ¶
type CreateEntryParams ¶
type CreateSessionParams ¶
type CreateTransferParams ¶
type CreateUserParams ¶
type ListAccountsParams ¶
type ListEntriesParams ¶
type Querier ¶
type Querier interface { AddAccountBalance(ctx context.Context, arg AddAccountBalanceParams) (Accounts, error) CreateAccount(ctx context.Context, arg CreateAccountParams) (Accounts, error) CreateEntry(ctx context.Context, arg CreateEntryParams) (Entries, error) CreateSession(ctx context.Context, arg CreateSessionParams) (Sessions, error) CreateTransfer(ctx context.Context, arg CreateTransferParams) (Transfer, error) CreateUser(ctx context.Context, arg CreateUserParams) (Users, error) DeleteAccount(ctx context.Context, id int64) error GetAccount(ctx context.Context, id int64) (Accounts, error) GetAccountForUpdate(ctx context.Context, id int64) (Accounts, error) GetEntry(ctx context.Context, id int64) (Entries, error) GetSession(ctx context.Context, username string) (Sessions, error) GetTransfer(ctx context.Context, id int64) (Transfer, error) GetUser(ctx context.Context, username string) (Users, error) ListAccounts(ctx context.Context, arg ListAccountsParams) ([]Accounts, error) ListEntries(ctx context.Context, arg ListEntriesParams) ([]Entries, error) TransferList(ctx context.Context, arg TransferListParams) ([]Transfer, error) UpdateAccount(ctx context.Context, arg UpdateAccountParams) (Accounts, error) }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AddAccountBalance ¶
func (*Queries) CreateAccount ¶
func (*Queries) CreateEntry ¶
func (*Queries) CreateSession ¶
func (*Queries) CreateTransfer ¶
func (*Queries) CreateUser ¶
func (*Queries) DeleteAccount ¶
func (*Queries) GetAccount ¶
func (*Queries) GetAccountForUpdate ¶
func (*Queries) GetSession ¶
func (*Queries) GetTransfer ¶
func (*Queries) ListAccounts ¶
func (*Queries) ListEntries ¶
func (*Queries) TransferList ¶
func (*Queries) UpdateAccount ¶
type SQLStore ¶
type SQLStore struct { *Queries // contains filtered or unexported fields }
func (*SQLStore) TransferTx ¶
func (store *SQLStore) TransferTx(ctx context.Context, arg TransferTxParams) (TransferTxResult, error)
TransferTx perform a money transfer from one account to the other it creates a transfer record, add account entries and update accounts balance within a single database transaction
type Sessions ¶
type Sessions struct { ID uuid.UUID `json:"id"` Username string `json:"username"` RefreshToken string `json:"refresh_token"` UserAgent string `json:"user_agent"` ClientIp string `json:"client_ip"` IsBlocked bool `json:"is_blocked"` ExpiredAt time.Time `json:"expired_at"` CreatedAt time.Time `json:"created_at"` }
type Store ¶
type Store interface { Querier TransferTx(ctx context.Context, arg TransferTxParams) (TransferTxResult, error) }
Store provides all function to execute db queries and transaction
type TransferListParams ¶
type TransferTxParams ¶
type TransferTxParams struct { FromAccountID int64 `json:"from_account_id"` ToAccountID int64 `json:"to_account_id"` Amount int64 `json:"amount"` }
TransferTxParams contains the input parameters of the transfer transaction
type TransferTxResult ¶
type TransferTxResult struct { Transfer Transfer `json:"transfer"` FromAccount Accounts `json:"from_account"` ToAccount Accounts `json:"to_account"` FromEntry Entries `json:"from_entry"` ToEntry Entries `json:"to_entry"` }
TransferTxResult is the result of the transaction
type UpdateAccountParams ¶
Click to show internal directories.
Click to hide internal directories.