Documentation ¶
Index ¶
- type Database
- func (db *Database) CountTotalTxsNum() (int32, error)
- func (db *Database) ExistToken(originalSymbol string) (exist bool, err error)
- func (db *Database) Ping() error
- func (db *Database) QueryAssetChartHistory(asset string, limit int) (stats []schema.StatAssetInfoList1H, err error)
- func (db *Database) QueryBlocks(before int, after int, limit int) (blocks []schema.Block, err error)
- func (db *Database) QueryLatestBlock() (block schema.Block, err error)
- func (db *Database) QueryLatestBlockHeight() (int64, error)
- func (db *Database) QueryTotalTxsNum(height int64) (int64, error)
- func (db *Database) QueryTx(height int64) (txs []schema.Transaction, err error)
- func (db *Database) QueryTxByHash(hash string) (tx schema.Transaction, err error)
- func (db *Database) QueryTxs(before int, after int, limit int) (txs []schema.Transaction, err error)
- func (db *Database) QueryTxsByType(txType string, startTime int64, endTime int64, before int, after int, ...) (txs []schema.Transaction, err error)
- func (db *Database) QueryValidatorByAccountAddr(address string) (validator schema.Validator, err error)
- func (db *Database) QueryValidatorByConsAddr(address string) (validator schema.Validator, err error)
- func (db *Database) QueryValidatorByMoniker(address string) (validator schema.Validator, err error)
- func (db *Database) QueryValidatorByOperAddr(address string) (schema.Validator, error)
- func (db *Database) QueryValidators() (validators []*schema.Validator, err error)
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) CountTotalTxsNum ¶
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 ¶
ExistToken checks to see if a token exists.
func (*Database) Ping ¶
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 ¶
QueryLatestBlock queries latest block information saved in database.
func (*Database) QueryLatestBlockHeight ¶
QueryLatestBlockHeight queries latest block height saved in database and return it.
func (*Database) QueryTotalTxsNum ¶
QueryTotalTxsNum queries total number of transactions up until that height
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) 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 ¶
QueryValidatorByMoniker queries validators in a validator set saved in database
func (*Database) QueryValidatorByOperAddr ¶
QueryValidatorByOperAddr queries validators in a validator set saved in database