psql

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostDB

type PostDB struct {
	DB bun.IDB
}

func InitDB

func InitDB(ctx context.Context, cfg *conf.DatabaseConfig, longTimeouts bool) (*PostDB, error)

InitDB creates postgresql db instance.

func (*PostDB) Delete

func (db *PostDB) Delete(ctx context.Context, table interface{}, round uint64) error

Delete deletes all records with round less than the given round.

func (*PostDB) GetBlockByHash

func (db *PostDB) GetBlockByHash(ctx context.Context, blockHash string) (*model.Block, error)

GetBlockByHash returns the block for the given hash.

func (*PostDB) GetBlockByNumber

func (db *PostDB) GetBlockByNumber(ctx context.Context, round uint64) (*model.Block, error)

GetBlockByNumber returns the block for the given round.

func (*PostDB) GetBlockHash

func (db *PostDB) GetBlockHash(ctx context.Context, round uint64) (string, error)

GetBlockHash returns block hash by block round.

func (*PostDB) GetBlockRound

func (db *PostDB) GetBlockRound(ctx context.Context, hash string) (uint64, error)

GetBlockRound returns block round by block hash.

func (*PostDB) GetBlockTransaction

func (db *PostDB) GetBlockTransaction(ctx context.Context, blockHash string, txIndex int) (*model.Transaction, error)

GetBlockTransaction returns transaction by bock hash and transaction index.

func (*PostDB) GetBlockTransactionCountByHash

func (db *PostDB) GetBlockTransactionCountByHash(ctx context.Context, blockHash string) (int, error)

GetBlockTransactionCountByHash returns the count of transactions in block by block hash.

func (*PostDB) GetBlockTransactionCountByNumber

func (db *PostDB) GetBlockTransactionCountByNumber(ctx context.Context, round uint64) (int, error)

GetBlockTransactionCountByNumber returns the count of transactions in block by block number.

func (*PostDB) GetLastIndexedRound

func (db *PostDB) GetLastIndexedRound(ctx context.Context) (uint64, error)

GetLastIndexedRound returns latest indexed block round.

func (*PostDB) GetLastRetainedRound

func (db *PostDB) GetLastRetainedRound(ctx context.Context) (uint64, error)

GetLastRetainedRound returns the minimum round not pruned.

func (*PostDB) GetLatestBlockHash

func (db *PostDB) GetLatestBlockHash(ctx context.Context) (string, error)

GetLatestBlockHash returns for the block hash of the latest round.

func (*PostDB) GetLatestBlockNumber

func (db *PostDB) GetLatestBlockNumber(ctx context.Context) (uint64, error)

GetLatestBlockNumber returns the latest block number.

func (*PostDB) GetLogs

func (db *PostDB) GetLogs(ctx context.Context, startRound, endRound uint64) ([]*model.Log, error)

GetLogs return the logs by block hash and round.

func (*PostDB) GetTransaction

func (db *PostDB) GetTransaction(ctx context.Context, hash string) (*model.Transaction, error)

GetTransaction queries ethereum transaction by hash.

func (*PostDB) GetTransactionReceipt

func (db *PostDB) GetTransactionReceipt(ctx context.Context, txHash string) (*model.Receipt, error)

GetTransactionReceipt returns receipt by transaction hash.

func (*PostDB) Insert added in v1.1.0

func (db *PostDB) Insert(ctx context.Context, value interface{}) error

Inserts a single record in the DB.

func (*PostDB) InsertIfNotExists added in v1.1.0

func (db *PostDB) InsertIfNotExists(ctx context.Context, value interface{}) error

InsertIfNotExists inserts the record if it does not yet exist.

func (*PostDB) RunInTransaction

func (db *PostDB) RunInTransaction(ctx context.Context, fn func(storage.Storage) error) error

RunInTransaction runs a function in a transaction. If function returns an error transaction is rolled back, otherwise transaction is committed.

func (*PostDB) RunMigrations

func (db *PostDB) RunMigrations(ctx context.Context) error

func (*PostDB) Upsert

func (db *PostDB) Upsert(ctx context.Context, value interface{}) error

Upsert upserts the record.

Jump to

Keyboard shortcuts

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