Documentation ¶
Index ¶
- func Builder(ctx *database.Context) (database.Database, error)
- type Database
- func (db *Database) Close()
- func (db *Database) GetBlockHeightTimeDayAgo(now time.Time) (dbtypes.BlockRow, error)
- func (db *Database) GetBlockHeightTimeHourAgo(now time.Time) (dbtypes.BlockRow, error)
- func (db *Database) GetBlockHeightTimeMinuteAgo(now time.Time) (dbtypes.BlockRow, error)
- func (db *Database) GetGenesis() (*types.Genesis, error)
- func (db *Database) GetLastBlock() (*dbtypes.BlockRow, error)
- func (db *Database) GetLastBlockHeight() (int64, error)
- func (db *Database) GetLastPruned() (int64, error)
- func (db *Database) GetTokensPriceID() ([]string, error)
- func (db *Database) GetValidatorsDescription() ([]types.ValidatorDescription, error)
- func (db *Database) HasBlock(height int64) (bool, error)
- func (db *Database) Prune(height int64) error
- func (db *Database) SaveAverageBlockTimeGenesis(averageTime float64, height int64) error
- func (db *Database) SaveAverageBlockTimePerDay(averageTime float64, height int64) error
- func (db *Database) SaveAverageBlockTimePerHour(averageTime float64, height int64) error
- func (db *Database) SaveAverageBlockTimePerMin(averageTime float64, height int64) error
- func (db *Database) SaveBlock(block *types.Block) error
- func (db *Database) SaveCommitSignatures(signatures []*types.CommitSig) error
- func (db *Database) SaveDoubleSignEvidence(evidence types.DoubleSignEvidence) error
- func (db *Database) SaveGenesis(genesis *types.Genesis) error
- func (db *Database) SaveIBCTransferParams(params *types.IBCTransferParams) error
- func (db *Database) SaveInflation(inflation string, height int64) error
- func (db *Database) SaveStakingPool(pool *types.StakingPool) error
- func (db *Database) SaveSupply(coins sdk.Coins, height int64) error
- func (db *Database) SaveToken(token types.Token) error
- func (db *Database) SaveTokensPrice(prices []types.TokenPrice) error
- func (db *Database) SaveTx(tx types.TxResponse) error
- func (db *Database) SaveValidatorCommission(validatorsCommission []types.ValidatorCommission) error
- func (db *Database) SaveValidatorDescription(description []types.ValidatorDescription) error
- func (db *Database) SaveValidators(validators []types.Validator) error
- func (db *Database) SaveValidatorsStatus(validatorsStatus []types.ValidatorStatus) error
- func (db *Database) SaveValidatorsVotingPower(entries []types.ValidatorVotingPower) error
- func (db *Database) StoreLastPruned(height int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database struct { Sql *sql.DB Sqlx *sqlx.DB EncodingConfig *params.EncodingConfig Logger logging.Logger }
Database defines a wrapper around a SQL database and implements functionality for data aggregation and exporting.
func (*Database) GetBlockHeightTimeDayAgo ¶
GetBlockHeightTimeDayAgo return block height and time that a block proposals about a day (24hour) ago from input date
func (*Database) GetBlockHeightTimeHourAgo ¶
GetBlockHeightTimeHourAgo return block height and time that a block proposals about a hour ago from input date
func (*Database) GetBlockHeightTimeMinuteAgo ¶
GetBlockHeightTimeMinuteAgo return block height and time that a block proposals about a minute ago from input date
func (*Database) GetGenesis ¶
GetGenesis returns the genesis information stored inside the database
func (*Database) GetLastBlock ¶
GetLastBlock returns the last block stored inside the database
func (*Database) GetLastBlockHeight ¶
GetLastBlockHeight returns the height of last block stored inside the database
func (*Database) GetLastPruned ¶
GetLastPruned implements database.PruningDb
func (*Database) GetTokensPriceID ¶
GetTokensPriceID returns the slice of price ids for all tokens stored in db
func (*Database) GetValidatorsDescription ¶
func (db *Database) GetValidatorsDescription() ([]types.ValidatorDescription, error)
GetValidatorDescription returns validators description from database.
func (*Database) SaveAverageBlockTimeGenesis ¶
SaveAverageBlockTimeGenesis save the average block time in average_block_time_from_genesis table
func (*Database) SaveAverageBlockTimePerDay ¶
SaveAverageBlockTimePerDay save the average block time in average_block_time_per_day table
func (*Database) SaveAverageBlockTimePerHour ¶
SaveAverageBlockTimePerHour save the average block time in average_block_time_per_hour table
func (*Database) SaveAverageBlockTimePerMin ¶
SaveAverageBlockTimePerMin save the average block time in average_block_time_per_minute table
func (*Database) SaveCommitSignatures ¶
SaveCommitSignatures implements database.Database
func (*Database) SaveDoubleSignEvidence ¶
func (db *Database) SaveDoubleSignEvidence(evidence types.DoubleSignEvidence) error
SaveDoubleSignEvidence saves the given double sign evidence inside the proper tables
func (*Database) SaveGenesis ¶
SaveGenesis save the given genesis data
func (*Database) SaveIBCTransferParams ¶
func (db *Database) SaveIBCTransferParams(params *types.IBCTransferParams) error
SaveIBCTransferParams allows to store the given ibc transfer params inside the database
func (*Database) SaveInflation ¶
SaveInflation allows to store the inflation for the given block height
func (*Database) SaveStakingPool ¶
func (db *Database) SaveStakingPool(pool *types.StakingPool) error
SaveStakingPool allows to store staking pool values for the given height
func (*Database) SaveSupply ¶
SaveSupply allows to store total supply for a given height
func (*Database) SaveTokensPrice ¶
func (db *Database) SaveTokensPrice(prices []types.TokenPrice) error
SaveTokensPrices stores the latest tokens price
func (*Database) SaveTx ¶
func (db *Database) SaveTx(tx types.TxResponse) error
SaveTx implements database.Database
func (*Database) SaveValidatorCommission ¶
func (db *Database) SaveValidatorCommission(validatorsCommission []types.ValidatorCommission) error
SaveValidatorCommission saves validators commission in database.
func (*Database) SaveValidatorDescription ¶
func (db *Database) SaveValidatorDescription(description []types.ValidatorDescription) error
SaveValidatorDescription save validators description in database.
func (*Database) SaveValidators ¶
SaveValidators implements database.Database
func (*Database) SaveValidatorsStatus ¶
func (db *Database) SaveValidatorsStatus(validatorsStatus []types.ValidatorStatus) error
SaveValidatorsStatus save latest validator in database
func (*Database) SaveValidatorsVotingPower ¶
func (db *Database) SaveValidatorsVotingPower(entries []types.ValidatorVotingPower) error
SaveValidatorsVotingPower saves the given validator voting powers.
func (*Database) StoreLastPruned ¶
StoreLastPruned implements database.PruningDb