db

package
v0.0.0-...-7c8ce1f Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	*pg.DB
}

Database implements a wrapper of golang ORM with focus on PostgreSQL.

func Connect

func Connect(cfg config.DBConfig) *Database

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

func (db *Database) CountTotalTxsNum() (int32, error)

CountTotalTxsNum counts total number of transactions saved in transaction table Note that count(*) raises performance issue as more txs saved in database

func (*Database) ExistToken

func (db *Database) ExistToken(originalSymbol string) (exist bool, err error)

ExistToken checks to see if a token exists.

func (*Database) Ping

func (db *Database) Ping() error

Ping returns a database connection handle An error is returned if the connection fails.

func (*Database) QueryAssetChartHistory

func (db *Database) QueryAssetChartHistory(asset string, limit int) (stats []schema.StatAssetInfoList1H, err error)

QueryAssetChartHistory queries asset chart history Stats Exporter needs to be executed and run at least 24 hours to get the result

func (*Database) QueryBlocks

func (db *Database) QueryBlocks(before int, after int, limit int) (blocks []schema.Block, err error)

QueryBlocks queries blocks with given params and return them.

func (*Database) QueryLatestBlock

func (db *Database) QueryLatestBlock() (block schema.Block, err error)

QueryLatestBlock queries latest block information saved in database.

func (*Database) QueryLatestBlockHeight

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

QueryLatestBlockHeight queries latest block height saved in database and return it.

func (*Database) QueryTx

func (db *Database) QueryTx(height int64) (txs []schema.Transaction, err error)

QueryTx queries particular transaction with height

func (*Database) QueryTxByHash

func (db *Database) QueryTxByHash(hash string) (tx schema.Transaction, err error)

QueryTxByHash queries transaction by transaction hash and return it.

func (*Database) QueryTxs

func (db *Database) QueryTxs(before int, after int, limit int) (txs []schema.Transaction, err error)

QueryTxs queries transactions with given params and return them.

func (*Database) QueryTxsBySigner

func (db *Database) QueryTxsBySigner(signerAddress sdk.AccAddress, limit int) (txs []schema.Transaction, err error)

func (*Database) QueryTxsByType

func (db *Database) QueryTxsByType(txType string, startTime int64, endTime int64, before int, after int, limit int) (txs []schema.Transaction, err error)

QueryTxsByType queries transactions with tx type, start time and end time and return them.

func (*Database) QueryValidatorByAccountAddr

func (db *Database) QueryValidatorByAccountAddr(address string) (validator schema.Validator, err error)

QueryValidatorByAccountAddr queries validators in a validator set saved in database.

func (*Database) QueryValidatorByConsAddr

func (db *Database) QueryValidatorByConsAddr(address string) (validator schema.Validator, err error)

QueryValidatorByConsAddr queries validators in a validator set saved in database.

func (*Database) QueryValidatorByMoniker

func (db *Database) QueryValidatorByMoniker(address string) (validator schema.Validator, err error)

QueryValidatorByMoniker queries validators in a validator set saved in database

func (*Database) QueryValidatorByOperAddr

func (db *Database) QueryValidatorByOperAddr(address string) (schema.Validator, error)

QueryValidatorByOperAddr queries validators in a validator set saved in database

func (*Database) QueryValidators

func (db *Database) QueryValidators() (validators []*schema.Validator, err error)

QueryValidators queries validators in a validator set saved in database

Jump to

Keyboard shortcuts

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