store

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DelegationsBatchSize = 1000 // max number of delegations to import per batch
)

Variables

View Source
var ErrNotFound = gorm.ErrRecordNotFound

Functions

func NewRaw

func NewRaw(connStr string) (*gorm.DB, error)

Types

type AddressesStore

type AddressesStore struct {
	*gorm.DB
}

func (AddressesStore) Import

func (s AddressesStore) Import(records []model.Address) error

type DB

type DB struct {
	Addresses  AddressesStore
	Validators ValidatorsStore
	Delegators DelegatorsStore
	Networks   NetworksStore
	// contains filtered or unexported fields
}

func New

func New(connStr string) (*DB, error)

func (DB) ResetTableSeqCounters

func (s DB) ResetTableSeqCounters() error

func (DB) Test

func (s DB) Test() error

type DelegationsSearch added in v0.2.1

type DelegationsSearch struct {
	NodeID        string `form:"node_id"`
	RewardAddress string `form:"reward_address"`
}

type DelegatorsStore

type DelegatorsStore struct {
	*gorm.DB
}

func (DelegatorsStore) Import

func (s DelegatorsStore) Import(records []model.Delegation, batchSize int) error

Import imports delegations records in bulk

func (DelegatorsStore) Search added in v0.2.1

func (s DelegatorsStore) Search(search DelegationsSearch) ([]model.Delegation, error)

Search performs a seach on delegations

type NetworksStore

type NetworksStore struct {
	*gorm.DB
}

func (NetworksStore) CreateMetric

func (s NetworksStore) CreateMetric(record *model.NetworkMetric) error

CreateMetric creates a new network metric record

func (NetworksStore) CreateStats

func (s NetworksStore) CreateStats(t time.Time, bucket string) error

CreateStats creates a stat for a given time bucket

func (NetworksStore) GetStats

func (s NetworksStore) GetStats(bucket string, limit int) ([]model.NetworkStat, error)

GetStats returns a set of stats for a given time bucket

type Row

type Row []interface{}

type RowFunc

type RowFunc func(int) Row

type ValidatorsSearch added in v0.2.1

type ValidatorsSearch struct {
	RewardAddress      string `form:"reward_address"`
	CapacityPercentMin uint   `form:"capacity_percent_min"`
	CapacityPercentMax uint   `form:"capacity_percent_max"`
}

func (ValidatorsSearch) Validate added in v0.2.1

func (s ValidatorsSearch) Validate() error

type ValidatorsStore

type ValidatorsStore struct {
	*gorm.DB
}

func (ValidatorsStore) CreateStats

func (s ValidatorsStore) CreateStats(t time.Time, bucket string) error

func (ValidatorsStore) FindByNodeID

func (s ValidatorsStore) FindByNodeID(id string) (*model.Validator, error)

func (ValidatorsStore) GetStats

func (s ValidatorsStore) GetStats(id string, bucket string, limit int) ([]model.ValidatorStat, error)

func (ValidatorsStore) Import

func (s ValidatorsStore) Import(records []model.Validator) error

func (ValidatorsStore) ImportSeq

func (s ValidatorsStore) ImportSeq(records []model.ValidatorSeq) error

func (ValidatorsStore) LastHeight

func (s ValidatorsStore) LastHeight() (int64, error)

func (ValidatorsStore) LastTime added in v0.2.1

func (s ValidatorsStore) LastTime() (*time.Time, error)

func (ValidatorsStore) PurgeSeq

func (s ValidatorsStore) PurgeSeq(before time.Time) (int64, error)

func (ValidatorsStore) Search added in v0.2.1

func (s ValidatorsStore) Search(search ValidatorsSearch) ([]model.Validator, error)

Jump to

Keyboard shortcuts

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