account

package
v0.0.0-...-71505b4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 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 Repo

type Repo interface {
	List(limit uint, offset uint, filter models.AccountFilter) (int64, []models.Account, error)
	Filter(filter models.Account, limit, offset uint) (accounts []models.Account, err error)
	Count(filter models.Account) (int64, error)
	Find(filter models.Account) (found bool, acc models.Account, err error)
	TotalBalance() (int64, error)
}

type Repository

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

Repository is the account repo implementation.

func New

func New(db *gorm.DB) *Repository

New creates an instance of repository using the provided db.

func (*Repository) Count

func (r *Repository) Count(filter models.Account) (count int64, err error)

Count counts a number of accounts sutisfying the filter.

func (*Repository) Filter

func (r *Repository) Filter(filter models.Account, limit, offset uint) (accounts []models.Account, err error)

Filter returns a list of accounts that sutisfies the filter.

func (*Repository) Find

func (r *Repository) Find(filter models.Account) (found bool, acc models.Account, err error)

Find looks up for an account with filter.

func (*Repository) List

func (r *Repository) List(limit, offset uint, filter models.AccountFilter) (count int64, accounts []models.Account, err error)

List returns a list of accounts from the newest to oldest. limit defines the limit for the maximum number of accounts returned. before is used to paginate results based on the level. As the result is ordered descendingly the accounts with level < before will be returned.

func (*Repository) TotalBalance

func (r *Repository) TotalBalance() (b int64, err error)

TotalBalance gets the total available balance of all accounts.

Directories

Path Synopsis
Package mock_account is a generated GoMock package.
Package mock_account is a generated GoMock package.

Jump to

Keyboard shortcuts

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