Help us shape the future of Go! Take the 2026 Go Developer Survey

blocks

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RangeSelectFilter

type RangeSelectFilter struct {
	StartBlock *string
	EndBlock   *string
}

TODO: replace string to int

func (RangeSelectFilter) Filter

func (f RangeSelectFilter) Filter(q *orm.Query) (*orm.Query, error)

type Repository

type Repository struct {
	DB *pg.DB
}

func NewRepository

func NewRepository(db *pg.DB) *Repository

func (Repository) GetAverageBlockTime

func (repository Repository) GetAverageBlockTime() float64

Get average block time

func (Repository) GetById

func (repository Repository) GetById(id uint64) *models.Block

Get block by height (id)

func (Repository) GetLastBlock

func (repository Repository) GetLastBlock() models.Block

Get last block

func (Repository) GetPaginated

func (repository Repository) GetPaginated(pagination *tools.Pagination) []models.Block

Get paginated list of blocks

func (Repository) GetSumSlowBlocksTimeBy24h

func (repository Repository) GetSumSlowBlocksTimeBy24h() float64

Get sum of delta slow time

type Resource

type Resource struct {
	ID          uint64               `json:"height"`
	Size        uint64               `json:"size"`
	NumTxs      uint32               `json:"txCount"`
	BlockTime   float64              `json:"blockTime"`
	CreatedAt   string               `json:"created_at"`
	BlockReward string               `json:"reward"`
	Hash        string               `json:"hash"`
	Validators  []resource.Interface `json:"validators"`
}

func (Resource) Transform

lastBlockId - uint64 pointer to the last block height, optional field.

type ValidatorResource

type ValidatorResource struct {
	PublicKey     string             `json:"publicKey"`
	ValidatorMeta resource.Interface `json:"validator_meta"`
	Signed        bool               `json:"signed"`
}

func (ValidatorResource) Transform

Jump to

Keyboard shortcuts

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