Documentation ¶
Index ¶
- type BakerCounter
- type BakerWeightedCounter
- type Repo
- type Repository
- func (r *Repository) BakerRegistryList() (bakers []models.BakerRegistry, err error)
- func (r *Repository) Balance(accountId string) (bal models.BakerBalance, err error)
- func (r *Repository) BlocksCountBakedBy(ids []string, startingLevel int64) (counter []BakerCounter, err error)
- func (r *Repository) Count() (count int64, err error)
- func (r *Repository) EndorsementsCountBy(ids []string, startingLevel int64) (counter []BakerWeightedCounter, err error)
- func (r *Repository) Find(accountID string) (found bool, baker models.Baker, err error)
- func (r *Repository) GetBakersStake(cycle uint64) (stakes []models.BakerDelegators, err error)
- func (r *Repository) GetBakersVoting() (stakes []models.BakerDelegators, err error)
- func (r *Repository) List(limit, offset uint, favorites []string) (bakers []models.Baker, err error)
- func (r *Repository) NumberOfDelegators(cycle uint64) (numbers []models.BakerDelegators, err error)
- func (r *Repository) PublicBakersCount() (count int64, err error)
- func (r *Repository) PublicBakersList(limit, offset uint, favorites []string) (bakers []models.Baker, err error)
- func (r *Repository) PublicBakersSearchList() (list []models.PublicBakerSearch, err error)
- func (r *Repository) RefreshView() (err error)
- func (r *Repository) SavePublicBaker(baker models.BakerRegistry) (err error)
- func (r *Repository) TotalBakingRewards(accountId string, fromCycle, toCycle int64) (rewards int64, err error)
- func (r *Repository) TotalEndorsementRewards(accountId string, fromCycle, toCycle int64) (rewards int64, err error)
- func (r *Repository) TotalStakingBalance() (b int64, err error)
- func (r *Repository) UpdateBaker(baker models.Baker) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BakerCounter ¶
type BakerWeightedCounter ¶
type BakerWeightedCounter struct { BakerCounter Weight float64 }
type Repo ¶
type Repo interface { Find(accountID string) (bool, models.Baker, error) List(limit, offset uint, favorites []string) ([]models.Baker, error) Count() (int64, error) BlocksCountBakedBy(ids []string, startingLevel int64) (counter []BakerCounter, err error) EndorsementsCountBy(ids []string, startingLevel int64) (counter []BakerWeightedCounter, err error) TotalStakingBalance() (int64, error) RefreshView() error Balance(accountId string) (bal models.BakerBalance, err error) //New PublicBakersCount() (int64, error) PublicBakersList(limit, offset uint, favorites []string) (bakers []models.Baker, err error) BakerRegistryList() ([]models.BakerRegistry, error) SavePublicBaker(models.BakerRegistry) error PublicBakersSearchList() ([]models.PublicBakerSearch, error) UpdateBaker(baker models.Baker) error TotalBakingRewards(accountId string, fromCycle, toCycle int64) (rewards int64, err error) TotalEndorsementRewards(accountId string, fromCycle, toCycle int64) (rewards int64, err error) NumberOfDelegators(cycle uint64) (numbers []models.BakerDelegators, err error) GetBakersStake(cycle uint64) (stakes []models.BakerDelegators, err error) GetBakersVoting() (stakes []models.BakerDelegators, err error) }
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is the baker repo implementation.
func New ¶
func New(db *gorm.DB) *Repository
New creates an instance of repository using the provided db.
func (*Repository) BakerRegistryList ¶
func (r *Repository) BakerRegistryList() (bakers []models.BakerRegistry, err error)
func (*Repository) Balance ¶
func (r *Repository) Balance(accountId string) (bal models.BakerBalance, err error)
func (*Repository) BlocksCountBakedBy ¶
func (r *Repository) BlocksCountBakedBy(ids []string, startingLevel int64) (counter []BakerCounter, err error)
BlocksCountBakedBy returns a slice of block counters with the number of blocks baked by each baker among ids.
func (*Repository) Count ¶
func (r *Repository) Count() (count int64, err error)
Count counts a number of bakers sutisfying the filter.
func (*Repository) EndorsementsCountBy ¶
func (r *Repository) EndorsementsCountBy(ids []string, startingLevel int64) (counter []BakerWeightedCounter, err error)
BlocksCountBakedBy returns a slice of block counters with the number of endorsements made by each baker among ids.
func (*Repository) GetBakersStake ¶
func (r *Repository) GetBakersStake(cycle uint64) (stakes []models.BakerDelegators, err error)
func (*Repository) GetBakersVoting ¶
func (r *Repository) GetBakersVoting() (stakes []models.BakerDelegators, err error)
func (*Repository) List ¶
func (r *Repository) List(limit, offset uint, favorites []string) (bakers []models.Baker, err error)
List returns a list of bakers(accounts which have at least 1 endorsement operation) ordered by their staking balance. limit defines the limit for the maximum number of bakers returned, offset sets the offset for thenumber of rows returned.
func (*Repository) NumberOfDelegators ¶
func (r *Repository) NumberOfDelegators(cycle uint64) (numbers []models.BakerDelegators, err error)
func (*Repository) PublicBakersCount ¶
func (r *Repository) PublicBakersCount() (count int64, err error)
Count counts a number of bakers sutisfying the filter.
func (*Repository) PublicBakersList ¶
func (*Repository) PublicBakersSearchList ¶
func (r *Repository) PublicBakersSearchList() (list []models.PublicBakerSearch, err error)
func (*Repository) RefreshView ¶
func (r *Repository) RefreshView() (err error)
RefreshView execute baker materialized view refresh
func (*Repository) SavePublicBaker ¶
func (r *Repository) SavePublicBaker(baker models.BakerRegistry) (err error)
func (*Repository) TotalBakingRewards ¶
func (r *Repository) TotalBakingRewards(accountId string, fromCycle, toCycle int64) (rewards int64, err error)
func (*Repository) TotalEndorsementRewards ¶
func (r *Repository) TotalEndorsementRewards(accountId string, fromCycle, toCycle int64) (rewards int64, err error)
func (*Repository) TotalStakingBalance ¶
func (r *Repository) TotalStakingBalance() (b int64, err error)
TotalStakingBalance gets the total staked balance of all delegates.
func (*Repository) UpdateBaker ¶
func (r *Repository) UpdateBaker(baker models.Baker) error