Documentation ¶
Index ¶
- func ConvertToBaker(delegate *models.Delegate) models.Baker
- func ConvertToBakers(delegates []models.Delegate) []models.Baker
- type BakerCounter
- type BakerWeightedCounter
- type Repo
- type Repository
- func (r *Repository) BlocksCountBakedBy(ids []string, startingLevel int64) (counter []BakerCounter, err error)
- func (r *Repository) Count(filter models.Delegate) (count int64, err error)
- func (r *Repository) EndorsementsCountBy(ids []string, startingLevel int64) (counter []BakerWeightedCounter, err error)
- func (r *Repository) EndorsementsOperationsCountBy(ids []string, startingLevel int64) (counter []BakerCounter, err error)
- func (r *Repository) ExtendBakers(bakers []models.Baker) (extended []models.Baker, err error)
- func (r *Repository) Find(accountID string) (found bool, delegate models.Delegate, err error)
- func (r *Repository) List(limit, offset uint) (bakers []models.Baker, err error)
- func (r *Repository) TotalStakingBalance() (b int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BakerCounter ¶
type BakerWeightedCounter ¶
type BakerWeightedCounter struct { BakerCounter Weight float64 }
type Repo ¶
type Repo interface { Find(accountID string) (bool, models.Delegate, error) List(limit, offset uint) ([]models.Baker, error) Count(filter models.Delegate) (int64, error) BlocksCountBakedBy(ids []string, startingLevel int64) (counter []BakerCounter, err error) EndorsementsCountBy(ids []string, startingLevel int64) (counter []BakerWeightedCounter, err error) TotalStakingBalance() (int64, 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) 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(filter models.Delegate) (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) EndorsementsOperationsCountBy ¶
func (r *Repository) EndorsementsOperationsCountBy(ids []string, startingLevel int64) (counter []BakerCounter, err error)
EndorsementsOperationsCountBy returns a slice of block counters with the number of endorsements made by each baker among ids.
func (*Repository) ExtendBakers ¶
func (*Repository) List ¶
func (r *Repository) List(limit, offset uint) (bakers []models.Baker, err error)
List returns a list of bakers 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) TotalStakingBalance ¶
func (r *Repository) TotalStakingBalance() (b int64, err error)
TotalStakingBalance gets the total staked balance of all delegates.