Documentation ¶
Index ¶
- Constants
- Variables
- type AccountsStore
- func (s AccountsStore) Conn() *sql.DB
- func (s AccountsStore) Create(record interface{}) error
- func (s AccountsStore) DeleteByHeight(height uint64) error
- func (s AccountsStore) FindByName(name string) (*model.Account, error)
- func (s AccountsStore) Import(records []model.Account) error
- func (s AccountsStore) Truncate() error
- func (s AccountsStore) Update(record interface{}) error
- type BlocksStore
- func (s BlocksStore) BlockStats(bucket string, limit uint) ([]byte, error)
- func (s BlocksStore) BlockTimes(limit int64) ([]byte, error)
- func (s BlocksStore) Conn() *sql.DB
- func (s BlocksStore) Create(record interface{}) error
- func (s BlocksStore) CreateIfNotExists(block *model.Block) error
- func (s BlocksStore) DeleteByHeight(height uint64) error
- func (s BlocksStore) FindBy(key string, value interface{}) (*model.Block, error)
- func (s BlocksStore) FindByHash(hash string) (*model.Block, error)
- func (s BlocksStore) FindByHeight(height uint64) (*model.Block, error)
- func (s BlocksStore) FindPrevious(height uint64) (*model.Block, error)
- func (s BlocksStore) Import(records []model.Block) error
- func (s BlocksStore) Last() (*model.Block, error)
- func (s BlocksStore) LastInEpoch(epoch string) (*model.Block, error)
- func (s BlocksStore) Search() ([]model.Block, error)
- func (s BlocksStore) Truncate() error
- func (s BlocksStore) Update(record interface{}) error
- type DelegatorEpochsSearch
- type DelegatorsStore
- func (s DelegatorsStore) AccountDelegationsSummary(account string) (*model.AccountDelegationsSummary, error)
- func (s DelegatorsStore) Conn() *sql.DB
- func (s DelegatorsStore) Create(record interface{}) error
- func (s DelegatorsStore) DeleteByHeight(height uint64) error
- func (s *DelegatorsStore) FetchRewardsByInterval(account string, validatorId string, from time.Time, to time.Time, ...) ([]model.RewardsSummary, error)
- func (s DelegatorsStore) FindDelegatorEpochBy(epoch string, accountId string, validatorId string) (*model.DelegatorEpoch, error)
- func (s DelegatorsStore) ImportDelegatorEpochs(records []model.DelegatorEpoch) error
- func (s DelegatorsStore) SearchDelegatorEpochs(search DelegatorEpochsSearch) ([]model.DelegatorEpoch, error)
- func (s DelegatorsStore) Truncate() error
- func (s DelegatorsStore) Update(record interface{}) error
- type EpochsStore
- func (s EpochsStore) Conn() *sql.DB
- func (s EpochsStore) Create(record interface{}) error
- func (s EpochsStore) DeleteByHeight(height uint64) error
- func (s EpochsStore) FindByID(id string) (*model.Epoch, error)
- func (s *EpochsStore) FindUnIndexedDelegatorsEpochs() ([]model.Epoch, error)
- func (s EpochsStore) Import(records []model.Epoch) error
- func (s EpochsStore) Recent(limit int) ([]model.Epoch, error)
- func (s EpochsStore) Truncate() error
- func (s EpochsStore) Update(record interface{}) error
- func (s EpochsStore) UpdateCounts(ids []string) error
- type EventsSearch
- type EventsStore
- func (s EventsStore) Conn() *sql.DB
- func (s EventsStore) Create(record interface{}) error
- func (s EventsStore) DeleteByHeight(height uint64) error
- func (s EventsStore) FindByID(id int) (*model.Event, error)
- func (s EventsStore) Import(records []model.Event) error
- func (s EventsStore) Search(search EventsSearch) (*PaginatedResult, error)
- func (s EventsStore) Truncate() error
- func (s EventsStore) Update(record interface{}) error
- type HeightRange
- type PaginatedResult
- type Pagination
- type StatsStore
- func (s StatsStore) Conn() *sql.DB
- func (s StatsStore) Create(record interface{}) error
- func (s StatsStore) CreateBlockStats(bucket string, timeRange TimeRange) error
- func (s StatsStore) CreateValidatorsStats(bucket string, ts time.Time) error
- func (s StatsStore) DeleteByHeight(height uint64) error
- func (s StatsStore) Truncate() error
- func (s StatsStore) Update(record interface{}) error
- type Store
- type TimeRange
- type TransactionsSearch
- type TransactionsStore
- func (s TransactionsStore) Conn() *sql.DB
- func (s TransactionsStore) Create(record interface{}) error
- func (s TransactionsStore) DeleteByHeight(height uint64) error
- func (s TransactionsStore) FindByBlock(hash string) ([]model.Transaction, error)
- func (s TransactionsStore) FindByHash(hash string) (*model.Transaction, error)
- func (s TransactionsStore) FindByHeight(height uint64) ([]model.Transaction, error)
- func (s TransactionsStore) FindByHeightRange(startHeight, endHeight uint64) ([]model.Transaction, error)
- func (s TransactionsStore) FindLowestHeightTransaction() (*model.Transaction, error)
- func (s TransactionsStore) FindTransactionsConfirmActions(start, end uint64) ([]model.Transaction, error)
- func (s TransactionsStore) Import(records []model.Transaction) error
- func (s TransactionsStore) Recent(n int) ([]model.Transaction, error)
- func (s TransactionsStore) Search(search TransactionsSearch) (*PaginatedResult, error)
- func (s TransactionsStore) SearchAccount(search TransactionsSearch) (*PaginatedResult, error)
- func (s TransactionsStore) Truncate() error
- func (s TransactionsStore) Update(record interface{}) error
- func (s TransactionsStore) UpdateTransactionMissingFields(trx model.Transaction) error
- type ValidatorAggsStore
- func (s ValidatorAggsStore) All() ([]model.ValidatorAgg, error)
- func (s ValidatorAggsStore) Conn() *sql.DB
- func (s ValidatorAggsStore) Create(record interface{}) error
- func (s ValidatorAggsStore) DeleteByHeight(height uint64) error
- func (s ValidatorAggsStore) FindBy(key string, value interface{}) (*model.ValidatorAgg, error)
- func (s ValidatorAggsStore) FindValidatorEpochs(account string, limit int) ([]model.ValidatorEpoch, error)
- func (s ValidatorAggsStore) FindValidatorEpochsByEpoch(epoch string) ([]model.ValidatorEpoch, error)
- func (s ValidatorAggsStore) Import(records []model.ValidatorAgg) error
- func (s ValidatorAggsStore) ImportValidatorEpochs(records []model.ValidatorEpoch) error
- func (s ValidatorAggsStore) PaginateValidatorEpochs(account string, pagination Pagination) (*PaginatedResult, error)
- func (s ValidatorAggsStore) Top() ([]model.ValidatorAgg, error)
- func (s ValidatorAggsStore) Truncate() error
- func (s ValidatorAggsStore) Update(record interface{}) error
- type ValidatorsStore
- func (s ValidatorsStore) ByHeight(height types.Height) ([]model.Validator, error)
- func (s ValidatorsStore) Cleanup(keepHeights uint64) (int64, error)
- func (s ValidatorsStore) Conn() *sql.DB
- func (s ValidatorsStore) Create(record interface{}) error
- func (s ValidatorsStore) DeleteByHeight(height uint64) error
- func (s ValidatorsStore) Import(records []model.Validator) error
- func (s ValidatorsStore) Truncate() error
- func (s ValidatorsStore) Update(record interface{}) error
Constants ¶
const ( BucketHour = "h" BucketDay = "d" )
Variables ¶
var (
ErrNotFound = errors.New("record not found")
)
Functions ¶
This section is empty.
Types ¶
type AccountsStore ¶
type AccountsStore struct {
// contains filtered or unexported fields
}
AccountsStore handles operations on account
func (AccountsStore) Create ¶
func (s AccountsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (AccountsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (AccountsStore) FindByName ¶
func (s AccountsStore) FindByName(name string) (*model.Account, error)
FindByName returns an account for a name
func (AccountsStore) Import ¶
func (s AccountsStore) Import(records []model.Account) error
Import imports new records and updates existing ones
type BlocksStore ¶
type BlocksStore struct {
// contains filtered or unexported fields
}
BlocksStore handles operations on blocks
func (BlocksStore) BlockStats ¶
func (s BlocksStore) BlockStats(bucket string, limit uint) ([]byte, error)
BlockStats returns block stats for a given interval
func (BlocksStore) BlockTimes ¶
func (s BlocksStore) BlockTimes(limit int64) ([]byte, error)
BlockTimes returns recent blocks averages
func (BlocksStore) Create ¶
func (s BlocksStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (BlocksStore) CreateIfNotExists ¶
func (s BlocksStore) CreateIfNotExists(block *model.Block) error
CreateIfNotExists creates the block if it does not exist
func (BlocksStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (BlocksStore) FindBy ¶
func (s BlocksStore) FindBy(key string, value interface{}) (*model.Block, error)
FindBy returns a block for a matching attribute
func (BlocksStore) FindByHash ¶
func (s BlocksStore) FindByHash(hash string) (*model.Block, error)
FindByHash returns a block with the matching hash
func (BlocksStore) FindByHeight ¶
func (s BlocksStore) FindByHeight(height uint64) (*model.Block, error)
FindByHeight returns a block with the matching height
func (BlocksStore) FindPrevious ¶ added in v0.3.0
func (s BlocksStore) FindPrevious(height uint64) (*model.Block, error)
FindPrevious returns a block prior to the given height
func (BlocksStore) Import ¶
func (s BlocksStore) Import(records []model.Block) error
Import creates block records in batch
func (BlocksStore) Last ¶ added in v0.3.0
func (s BlocksStore) Last() (*model.Block, error)
Last returns the last indexed block
func (BlocksStore) LastInEpoch ¶ added in v0.3.0
func (s BlocksStore) LastInEpoch(epoch string) (*model.Block, error)
LastInEpoch returns the last block in the given epoch
func (BlocksStore) Search ¶
func (s BlocksStore) Search() ([]model.Block, error)
Search returns matching blocks
type DelegatorEpochsSearch ¶ added in v0.7.0
type DelegatorEpochsSearch struct { AccountID string `form:"account_id"` ValidatorID string `form:"validator_id"` Epoch string `form:"epoch"` }
func (*DelegatorEpochsSearch) Validate ¶ added in v0.7.0
func (s *DelegatorEpochsSearch) Validate() error
type DelegatorsStore ¶ added in v0.5.0
type DelegatorsStore struct {
// contains filtered or unexported fields
}
DelegatorsStore handles operations on blocks
func (DelegatorsStore) AccountDelegationsSummary ¶ added in v0.14.0
func (s DelegatorsStore) AccountDelegationsSummary(account string) (*model.AccountDelegationsSummary, error)
AccountDelegationsSummary returns account delegations summary for the last epoch
func (DelegatorsStore) Create ¶ added in v0.5.0
func (s DelegatorsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (DelegatorsStore) DeleteByHeight ¶ added in v0.5.0
DeleteByHeight removes all records associated with a height
func (*DelegatorsStore) FetchRewardsByInterval ¶ added in v0.5.0
func (s *DelegatorsStore) FetchRewardsByInterval(account string, validatorId string, from time.Time, to time.Time, timeInterval model.TimeInterval) ([]model.RewardsSummary, error)
FetchRewardsByInterval fetches reward by interval
func (DelegatorsStore) FindDelegatorEpochBy ¶ added in v0.5.0
func (s DelegatorsStore) FindDelegatorEpochBy(epoch string, accountId string, validatorId string) (*model.DelegatorEpoch, error)
FindDelegatorEpochBy returns delegator epoch by epoch and account id
func (DelegatorsStore) ImportDelegatorEpochs ¶ added in v0.5.0
func (s DelegatorsStore) ImportDelegatorEpochs(records []model.DelegatorEpoch) error
ImportDelegatorEpochs creates new validators in batch
func (DelegatorsStore) SearchDelegatorEpochs ¶ added in v0.7.0
func (s DelegatorsStore) SearchDelegatorEpochs(search DelegatorEpochsSearch) ([]model.DelegatorEpoch, error)
SearchDelegatorEpochs performs a delegator epoch search and returns matching records
type EpochsStore ¶ added in v0.3.0
type EpochsStore struct {
// contains filtered or unexported fields
}
EpochsStore manages epochs records
func (EpochsStore) Create ¶ added in v0.3.0
func (s EpochsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (EpochsStore) DeleteByHeight ¶ added in v0.3.0
DeleteByHeight removes all records associated with a height
func (EpochsStore) FindByID ¶ added in v0.3.0
func (s EpochsStore) FindByID(id string) (*model.Epoch, error)
FindByID returns an epoch for a given ID
func (*EpochsStore) FindUnIndexedDelegatorsEpochs ¶ added in v0.9.0
func (s *EpochsStore) FindUnIndexedDelegatorsEpochs() ([]model.Epoch, error)
FindUnIndexedDelegatorsEpochs fetches un indexed delegators' epochs
func (EpochsStore) Import ¶ added in v0.3.0
func (s EpochsStore) Import(records []model.Epoch) error
Import created epochs records in batch
func (EpochsStore) Recent ¶ added in v0.3.0
func (s EpochsStore) Recent(limit int) ([]model.Epoch, error)
Recent returns a set of recent epochs
func (EpochsStore) Truncate ¶ added in v0.3.0
func (s EpochsStore) Truncate() error
Truncate removes all records from the table
func (EpochsStore) Update ¶ added in v0.3.0
func (s EpochsStore) Update(record interface{}) error
Update updates the existing record. Must pass a pointer.
func (EpochsStore) UpdateCounts ¶ added in v0.3.0
func (s EpochsStore) UpdateCounts(ids []string) error
UpdateCounts updates epoch counts for a given set of epoch IDs
type EventsSearch ¶ added in v0.3.0
type EventsStore ¶ added in v0.3.0
type EventsStore struct {
// contains filtered or unexported fields
}
EventsStore manages events records
func (EventsStore) Create ¶ added in v0.3.0
func (s EventsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (EventsStore) DeleteByHeight ¶ added in v0.3.0
DeleteByHeight removes all records associated with a height
func (EventsStore) FindByID ¶ added in v0.3.0
func (s EventsStore) FindByID(id int) (*model.Event, error)
FindByID returns an event for a given ID
func (EventsStore) Import ¶ added in v0.3.0
func (s EventsStore) Import(records []model.Event) error
func (EventsStore) Search ¶ added in v0.3.0
func (s EventsStore) Search(search EventsSearch) (*PaginatedResult, error)
Search performs an event search and returns matching records
type HeightRange ¶ added in v0.3.0
type PaginatedResult ¶ added in v0.3.0
type Pagination ¶ added in v0.3.0
func (*Pagination) Validate ¶ added in v0.3.0
func (p *Pagination) Validate() error
type StatsStore ¶
type StatsStore struct {
// contains filtered or unexported fields
}
func (StatsStore) Create ¶
func (s StatsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (StatsStore) CreateBlockStats ¶
func (s StatsStore) CreateBlockStats(bucket string, timeRange TimeRange) error
CreateBlockStats populates block stats for given block height range
func (StatsStore) CreateValidatorsStats ¶
func (s StatsStore) CreateValidatorsStats(bucket string, ts time.Time) error
CreateValidatorsStats populates validators stats for a time bucket
func (StatsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
type Store ¶
type Store struct { Blocks BlocksStore Epochs EpochsStore Accounts AccountsStore Delegators DelegatorsStore Validators ValidatorsStore ValidatorAggs ValidatorAggsStore Transactions TransactionsStore Stats StatsStore Events EventsStore // contains filtered or unexported fields }
Store handles all database operations
func (*Store) SetDebugMode ¶
SetDebugMode enabled detailed query logging
type TransactionsSearch ¶ added in v0.3.3
type TransactionsSearch struct { Pagination BlockHash string `form:"block_hash"` BlockHeight uint64 `form:"block_height"` Sender string `form:"sender"` Receiver string `form:"receiver"` Account string `form:"account"` StartDate string `form:"start_date"` EndDate string `form:"end_date"` StartHeight int `form:"start_height"` EndHeight int `form:"end_height"` // contains filtered or unexported fields }
func (*TransactionsSearch) Validate ¶ added in v0.3.3
func (s *TransactionsSearch) Validate() error
type TransactionsStore ¶ added in v0.2.0
type TransactionsStore struct {
// contains filtered or unexported fields
}
func (TransactionsStore) Create ¶ added in v0.2.0
func (s TransactionsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (TransactionsStore) DeleteByHeight ¶ added in v0.2.0
DeleteByHeight removes all records associated with a height
func (TransactionsStore) FindByBlock ¶ added in v0.2.1
func (s TransactionsStore) FindByBlock(hash string) ([]model.Transaction, error)
FindByBlock returns a collection of transactions for a block hash
func (TransactionsStore) FindByHash ¶ added in v0.2.1
func (s TransactionsStore) FindByHash(hash string) (*model.Transaction, error)
FindByHash returns a transaction record by hash
func (TransactionsStore) FindByHeight ¶ added in v0.11.0
func (s TransactionsStore) FindByHeight(height uint64) ([]model.Transaction, error)
FindByHeight returns transactions for given height
func (TransactionsStore) FindByHeightRange ¶ added in v0.12.1
func (s TransactionsStore) FindByHeightRange(startHeight, endHeight uint64) ([]model.Transaction, error)
FindByHeightRange returns transactions for a given block height range
func (TransactionsStore) FindLowestHeightTransaction ¶ added in v0.11.0
func (s TransactionsStore) FindLowestHeightTransaction() (*model.Transaction, error)
FindLowestHeightTransaction returns transaction with the lowest height
func (TransactionsStore) FindTransactionsConfirmActions ¶ added in v0.16.1
func (s TransactionsStore) FindTransactionsConfirmActions(start, end uint64) ([]model.Transaction, error)
FindTransactionsConfirmActions returns transactions with confirm actions
func (TransactionsStore) Import ¶ added in v0.2.0
func (s TransactionsStore) Import(records []model.Transaction) error
Import imports transactions in bulk
func (TransactionsStore) Recent ¶ added in v0.2.1
func (s TransactionsStore) Recent(n int) ([]model.Transaction, error)
Recent returns the most recent N transactions
func (TransactionsStore) Search ¶ added in v0.3.3
func (s TransactionsStore) Search(search TransactionsSearch) (*PaginatedResult, error)
Search performs a transaction search and returns matching records
func (TransactionsStore) SearchAccount ¶ added in v0.18.9
func (s TransactionsStore) SearchAccount(search TransactionsSearch) (*PaginatedResult, error)
Search performs a transaction search and returns matching records
func (TransactionsStore) Truncate ¶ added in v0.2.0
func (s TransactionsStore) Truncate() error
Truncate removes all records from the table
func (TransactionsStore) Update ¶ added in v0.2.0
func (s TransactionsStore) Update(record interface{}) error
Update updates the existing record. Must pass a pointer.
func (TransactionsStore) UpdateTransactionMissingFields ¶ added in v0.11.0
func (s TransactionsStore) UpdateTransactionMissingFields(trx model.Transaction) error
UpdateTransactionMissingFields updates transactions missing fields
type ValidatorAggsStore ¶
type ValidatorAggsStore struct {
// contains filtered or unexported fields
}
func (ValidatorAggsStore) All ¶
func (s ValidatorAggsStore) All() ([]model.ValidatorAgg, error)
All returns all validator records
func (ValidatorAggsStore) Create ¶
func (s ValidatorAggsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (ValidatorAggsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (ValidatorAggsStore) FindBy ¶
func (s ValidatorAggsStore) FindBy(key string, value interface{}) (*model.ValidatorAgg, error)
FindBy returns an validator agg record for a key and value
func (ValidatorAggsStore) FindValidatorEpochs ¶ added in v0.1.2
func (s ValidatorAggsStore) FindValidatorEpochs(account string, limit int) ([]model.ValidatorEpoch, error)
FindValidatorEpochs returns the last N validator epochs
func (ValidatorAggsStore) FindValidatorEpochsByEpoch ¶ added in v0.9.0
func (s ValidatorAggsStore) FindValidatorEpochsByEpoch(epoch string) ([]model.ValidatorEpoch, error)
FindValidatorEpochsByEpoch returns validator epochs for given epoch
func (ValidatorAggsStore) Import ¶
func (s ValidatorAggsStore) Import(records []model.ValidatorAgg) error
Import create validator aggregates in batch
func (ValidatorAggsStore) ImportValidatorEpochs ¶
func (s ValidatorAggsStore) ImportValidatorEpochs(records []model.ValidatorEpoch) error
ImportValidatorEpochs imports validator epochs records in batch
func (ValidatorAggsStore) PaginateValidatorEpochs ¶ added in v0.3.0
func (s ValidatorAggsStore) PaginateValidatorEpochs(account string, pagination Pagination) (*PaginatedResult, error)
PaginateValidatorEpochs returns a paginated search of validator epochs
func (ValidatorAggsStore) Top ¶
func (s ValidatorAggsStore) Top() ([]model.ValidatorAgg, error)
Top returns top validators
type ValidatorsStore ¶
type ValidatorsStore struct {
// contains filtered or unexported fields
}
ValidatorsStore handles operations on blocks
func (ValidatorsStore) Cleanup ¶
func (s ValidatorsStore) Cleanup(keepHeights uint64) (int64, error)
Cleanup removes old validator records and keeps the N most recent ones
func (ValidatorsStore) Create ¶
func (s ValidatorsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (ValidatorsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (ValidatorsStore) Import ¶
func (s ValidatorsStore) Import(records []model.Validator) error
Import creates new validators in batch