Documentation ¶
Index ¶
- type Database
- func (db *Database) CreateTables() error
- func (db *Database) ExistValidator(valAddr string) (bool, error)
- func (db *Database) InsertExportedData(block *schema.Block, txs []*schema.Transaction, vals []*schema.Validator, ...) error
- func (db *Database) Ping() error
- func (db *Database) QueryLatestBlockHeight() (int64, error)
- func (db *Database) QueryValidatorMoniker(valAddr string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
Database implements a wrapper of golang ORM with focus on PostgreSQL
func Connect ¶
Connect opens a database connections with the given database connection info from config. It returns a database connection handle or an error if the connection fails.
func (*Database) CreateTables ¶
CreateTables creates database tables using object relational mapping (ORM)
func (*Database) ExistValidator ¶
ExistValidator returns boolean after checking if a validator exists in database.
func (*Database) InsertExportedData ¶
func (db *Database) InsertExportedData(block *schema.Block, txs []*schema.Transaction, vals []*schema.Validator, precommits []*schema.PreCommit) error
InsertExportedData inserts exported block, transaction data RunInTransaction runs a function in a transaction. if function returns an error transaction is rollbacked, otherwise transaction is committed.
func (*Database) Ping ¶
Ping returns a database connection handle or an error if the connection fails.
func (*Database) QueryLatestBlockHeight ¶
QueryLatestBlockHeight queries latest block height in database.
func (*Database) QueryValidatorMoniker ¶
QueryValidatorMoniker returns validator's moniker.