persistence

package
v0.0.0-...-c5cd83c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID       int64
	Username string
	Balance  string
	Version  int32
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) GetAccount

func (q *Queries) GetAccount(ctx context.Context, username string) (Account, error)

func (*Queries) GetAccountAndLockForUpdates

func (q *Queries) GetAccountAndLockForUpdates(ctx context.Context, username string) (Account, error)

func (*Queries) UpdateAccountBalance

func (q *Queries) UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) error

func (*Queries) UpdateAccountBalanceVersion

func (q *Queries) UpdateAccountBalanceVersion(ctx context.Context, arg UpdateAccountBalanceVersionParams) (sql.Result, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type UpdateAccountBalanceParams

type UpdateAccountBalanceParams struct {
	Balance string
	ID      int64
}

type UpdateAccountBalanceVersionParams

type UpdateAccountBalanceVersionParams struct {
	Balance string
	ID      int64
	Version int32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL