Documentation
¶
Index ¶
- func Builder(cfg *config.PostgreSQLConfig, codec *codec.Codec) (db.Database, error)
- type Database
- func (db Database) HasBlock(height int64) (bool, error)
- func (db Database) HasValidator(addr string) (bool, error)
- func (db Database) LastBlockHeight() (int64, error)
- func (db Database) SaveBlock(block *tmctypes.ResultBlock, totalGas, preCommits uint64) error
- func (db Database) SaveCommitSig(height int64, pc tmtypes.CommitSig, votingPower, proposerPriority int64) error
- func (db Database) SaveTx(tx *types.Tx) error
- func (db Database) SaveValidator(addr, pk string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
Database defines a wrapper around a SQL database and implements functionality for data aggregation and exporting.
func (Database) HasBlock ¶
HasBlock returns true if a block by height exists. An error should never be returned.
func (Database) HasValidator ¶
HasValidator returns true if a given validator by HEX address exists. An error should never be returned.
func (Database) LastBlockHeight ¶
LastBlockHeight returns the latest block stored.
func (Database) SaveBlock ¶
func (db Database) SaveBlock(block *tmctypes.ResultBlock, totalGas, preCommits uint64) error
SetBlock stores a block and returns the resulting record ID. An error is returned if the operation fails.
func (Database) SaveCommitSig ¶
func (db Database) SaveCommitSig(height int64, pc tmtypes.CommitSig, votingPower, proposerPriority int64) error
SetPreCommit stores a validator's pre-commit and returns the resulting record ID. An error is returned if the operation fails.
func (Database) SaveTx ¶
SetTx stores a transaction and returns the resulting record ID. An error is returned if the operation fails.
func (Database) SaveValidator ¶
SetValidator stores a validator if it does not already exist. An error is returned if the operation fails.