accountspg

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrQuery        = errors.New("failed to run query")
	ErrScanningRows = errors.New("failed to scan rows returned from query")
)

Functions

func CreateTestAccountBatch

func CreateTestAccountBatch(pool *pgxpool.Pool, ids []account.ID, cpfs []string, amount []int) error

Types

type Repository

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

func NewRepository

func NewRepository(pool *pgxpool.Pool) *Repository

func (Repository) Create

func (r Repository) Create(ctx context.Context, accountInstance account.Account) (account.Account, error)

func (Repository) CreditAccount

func (r Repository) CreditAccount(ctx context.Context, id account.ID, amount money.Money) error

func (Repository) DebitAccount

func (r Repository) DebitAccount(ctx context.Context, id account.ID, amount money.Money) error

func (Repository) Fetch

func (r Repository) Fetch(ctx context.Context) ([]account.Account, error)

func (Repository) GetBalance

func (r Repository) GetBalance(ctx context.Context, id account.ID) (int, error)

func (Repository) GetByCpf

func (r Repository) GetByCpf(ctx context.Context, cpf cpf.Cpf) (account.Account, error)

func (Repository) GetByID

func (r Repository) GetByID(ctx context.Context, id account.ID) (account.Account, error)

Jump to

Keyboard shortcuts

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