repository

package
v0.0.0-...-5122af3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOverdraft = errors.New("not enough cash on bank account")
)

Functions

func MigrateSchema

func MigrateSchema(dsn string) error

func NewDB

func NewDB(cfg *config.DB) (*sqlx.DB, error)

Types

type BalanceDB

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

func NewBalanceDB

func NewBalanceDB(db *sqlx.DB, log *zap.Logger, initCash int) *BalanceDB

func (*BalanceDB) CashOut

func (b *BalanceDB) CashOut(ctx context.Context, bl *models.Balance,
) (int64, error)

func (*BalanceDB) CreateBalance

func (b *BalanceDB) CreateBalance(
	ctx context.Context,
	userID int,
) error

func (*BalanceDB) GetBalance

func (b *BalanceDB) GetBalance(ctx context.Context, userID int) (uint64, error)

func (*BalanceDB) ListCashedBalance

func (b *BalanceDB) ListCashedBalance(ctx context.Context) ([]models.Balance, error)

Jump to

Keyboard shortcuts

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