postgresql

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: CC0-1.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builder

func Builder(ctx *database.Context) (database.Database, error)

Builder creates a database connection with the given database connection info from config. It returns a database connection handle or an error if the connection fails.

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) Close

func (db *Database) Close()

Close implements database.Database

func (*Database) GetBlockHeightTimeDayAgo

func (db *Database) GetBlockHeightTimeDayAgo(now time.Time) (dbtypes.BlockRow, error)

GetBlockHeightTimeDayAgo return block height and time that a block proposals about a day (24hour) ago from input date

func (*Database) GetBlockHeightTimeHourAgo

func (db *Database) GetBlockHeightTimeHourAgo(now time.Time) (dbtypes.BlockRow, error)

GetBlockHeightTimeHourAgo return block height and time that a block proposals about a hour ago from input date

func (*Database) GetBlockHeightTimeMinuteAgo

func (db *Database) GetBlockHeightTimeMinuteAgo(now time.Time) (dbtypes.BlockRow, error)

GetBlockHeightTimeMinuteAgo return block height and time that a block proposals about a minute ago from input date

func (*Database) GetGenesis

func (db *Database) GetGenesis() (*types.Genesis, error)

GetGenesis returns the genesis information stored inside the database

func (*Database) GetLastBlock

func (db *Database) GetLastBlock() (*dbtypes.BlockRow, error)

GetLastBlock returns the last block stored inside the database

func (*Database) GetLastBlockHeight

func (db *Database) GetLastBlockHeight() (int64, error)

GetLastBlockHeight returns the height of last block stored inside the database

func (*Database) GetLastPruned

func (db *Database) GetLastPruned() (int64, error)

GetLastPruned implements database.PruningDb

func (*Database) GetTokensPriceID

func (db *Database) GetTokensPriceID() ([]string, error)

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) HasBlock

func (db *Database) HasBlock(height int64) (bool, error)

HasBlock implements database.Database

func (*Database) Prune

func (db *Database) Prune(height int64) error

Prune implements database.PruningDb

func (*Database) SaveAverageBlockTimeGenesis

func (db *Database) SaveAverageBlockTimeGenesis(averageTime float64, height int64) error

SaveAverageBlockTimeGenesis save the average block time in average_block_time_from_genesis table

func (*Database) SaveAverageBlockTimePerDay

func (db *Database) SaveAverageBlockTimePerDay(averageTime float64, height int64) error

SaveAverageBlockTimePerDay save the average block time in average_block_time_per_day table

func (*Database) SaveAverageBlockTimePerHour

func (db *Database) SaveAverageBlockTimePerHour(averageTime float64, height int64) error

SaveAverageBlockTimePerHour save the average block time in average_block_time_per_hour table

func (*Database) SaveAverageBlockTimePerMin

func (db *Database) SaveAverageBlockTimePerMin(averageTime float64, height int64) error

SaveAverageBlockTimePerMin save the average block time in average_block_time_per_minute table

func (*Database) SaveBlock

func (db *Database) SaveBlock(block *types.Block) error

SaveBlock implements database.Database

func (*Database) SaveCommitSignatures

func (db *Database) SaveCommitSignatures(signatures []*types.CommitSig) error

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

func (db *Database) SaveGenesis(genesis *types.Genesis) error

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

func (db *Database) SaveInflation(inflation string, height int64) error

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

func (db *Database) SaveSupply(coins sdk.Coins, height int64) error

SaveSupply allows to store total supply for a given height

func (*Database) SaveToken

func (db *Database) SaveToken(token types.Token) error

SaveToken allows to save the given token details

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

func (db *Database) SaveValidators(validators []types.Validator) error

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

func (db *Database) StoreLastPruned(height int64) error

StoreLastPruned implements database.PruningDb

Jump to

Keyboard shortcuts

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