repo

package
v0.0.0-...-782ff9b Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotEnoughMoney error = errors.New("not enough money")

Functions

This section is empty.

Types

type AccountRepo

type AccountRepo struct {
	*postgres.Postgres
}

AccountRepo - repository with account.

func New

func New(pg *postgres.Postgres) *AccountRepo

New - create new account repository.

func (*AccountRepo) Create

func (r *AccountRepo) Create(ctx context.Context) (acc entity.Account, err error)

Create - create new account with default values.

func (*AccountRepo) GetById

func (r *AccountRepo) GetById(ctx context.Context, id int64) (acc entity.Account, err error)

GetByID - get account's values by ID.

func (*AccountRepo) GetHistory

func (r *AccountRepo) GetHistory(ctx context.Context, id int64, limit, offset uint64, sort string, isDecreasing bool) (trns []*entity.Transaction, err error)

GetHistory - get history of transaction.

func (*AccountRepo) TransferAmount

func (r *AccountRepo) TransferAmount(ctx context.Context, redeemId, accrId int64, amount float64) (accrAcc, redeemAcc entity.Account, err error)

TransferAmount - transfer amount of money from redeem account to accrual account.

func (*AccountRepo) UpdBalance

func (r *AccountRepo) UpdBalance(ctx context.Context, id, docNum int64, amount float64) (acc entity.Account, err error)

UpdBalance - update account's balance.

Jump to

Keyboard shortcuts

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