postgresql

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: CC0-1.0 Imports: 9 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
	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) GetLastPruned

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

GetLastPruned implements database.PruningDb

func (*Database) HasBlock

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

HasBlock implements database.Database

func (*Database) HasValidator

func (db *Database) HasValidator(addr string) (bool, error)

HasValidator implements database.Database

func (*Database) LastBlockHeight

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

LastBlockHeight implements database.Database

func (*Database) Prune

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

Prune implements database.PruningDb

func (*Database) RunTx

func (db *Database) RunTx(fn func(tx *sql.Tx) error) error

RunTx allows to run a transaction inside this database instance

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

func (db *Database) SaveMessage(msg *types.Message) error

SaveMessage implements database.Database

func (*Database) SaveTx

func (db *Database) SaveTx(tx *types.Tx) error

SaveTx implements database.Database

func (*Database) SaveValidators

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

SaveValidators implements database.Database

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