account

package
v0.0.0-...-80b2b3e Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 4 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.AccountListView, error)
	Filter(filter models.Account, limit, offset uint) (accounts []models.AccountListView, err error)
	Count(filter models.Account) (int64, error)
	Find(filter models.Account) (found bool, acc models.AccountListView, err error)
	TotalBalance() (int64, error)
	Balances(string, time.Time, time.Time) ([]models.AccountBalance, error)
	PrevBalance(string, time.Time) (bool, models.AccountBalance, error)
	RewardsList(accountID string, limit uint, offset uint) (count int64, rewards []models.AccountReward, err error)
	RewardsCountList(accountID string, limit uint) (rewards []models.AccountRewardsCount, err error)
	CycleDelegatorsTotal(accountID string, cycleID int64) (reward models.AccountReward, err error)
	CycleDelegators(accountID string, cycle int64, limit uint, offset uint) (delegators []models.AccountDelegator, err error)
	GetReport(accountID string, params models.ReportFilter) (report []models.ExtendReport, err error)
	GetBakingReport(accountID string, params models.ReportFilter) (report []models.ExtendReport, err error)
	GetBakerChangesByLastCycle() (bakers []models.BakerChanges, err error)
	GetCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)
	GetCount(from time.Time, to time.Time) (count int64, err error)
	GetCountWhereBalance(lessThen int64) (count int64, err error)
	GetCountActive(from time.Time) (count int64, err error)
	GetCountActiveByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)
	GetContractsCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)
	GetContractsCount(from time.Time, to time.Time) (count int64, err error)
	RichAccounts(limit uint) (accounts []models.Account, err 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) Balances

func (r *Repository) Balances(accountId string, from time.Time, to time.Time) (bal []models.AccountBalance, err error)

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) CycleDelegators

func (r *Repository) CycleDelegators(accountID string, cycle int64, limit uint, offset uint) (delegators []models.AccountDelegator, err error)

func (*Repository) CycleDelegatorsTotal

func (r *Repository) CycleDelegatorsTotal(accountID string, cycleID int64) (reward models.AccountReward, err error)

func (*Repository) Filter

func (r *Repository) Filter(filter models.Account, limit, offset uint) (accounts []models.AccountListView, 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.AccountListView, err error)

Find looks up for an account with filter.

func (*Repository) GetBakerChangesByLastCycle

func (r *Repository) GetBakerChangesByLastCycle() (bakers []models.BakerChanges, err error)

func (*Repository) GetBakingReport

func (r *Repository) GetBakingReport(accountID string, params models.ReportFilter) (report []models.ExtendReport, err error)

func (*Repository) GetContractsCount

func (r *Repository) GetContractsCount(from time.Time, to time.Time) (count int64, err error)

func (*Repository) GetContractsCountByPeriod

func (r *Repository) GetContractsCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*Repository) GetCount

func (r *Repository) GetCount(from time.Time, to time.Time) (count int64, err error)

func (*Repository) GetCountActive

func (r *Repository) GetCountActive(from time.Time) (count int64, err error)

func (*Repository) GetCountActiveByPeriod

func (r *Repository) GetCountActiveByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*Repository) GetCountByPeriod

func (r *Repository) GetCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*Repository) GetCountWhereBalance

func (r *Repository) GetCountWhereBalance(lessThen int64) (count int64, err error)

func (*Repository) GetReport

func (r *Repository) GetReport(accountID string, params models.ReportFilter) (report []models.ExtendReport, err error)

func (*Repository) List

func (r *Repository) List(limit, offset uint, filter models.AccountFilter) (count int64, accounts []models.AccountListView, 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) PrevBalance

func (r *Repository) PrevBalance(accountId string, from time.Time) (found bool, balance models.AccountBalance, err error)

func (*Repository) RewardsCountList

func (r *Repository) RewardsCountList(accountID string, limit uint) (rewards []models.AccountRewardsCount, err error)

func (*Repository) RewardsList

func (r *Repository) RewardsList(accountID string, limit uint, offset uint) (count int64, rewards []models.AccountReward, err error)

func (*Repository) RichAccounts

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

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