postgresql

package
v0.0.0-...-2adbdf0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: CC0-1.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_PARAMS_LENGTH = 65535

Variables

This section is empty.

Functions

func Builder

func Builder(ctx *db.Context) (db.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 {
	Sqlx   *sqlx.DB
	Logger logging.Logger
}

Database defines a wrapper around a SQL database and implements functionality for data aggregation and exporting.

func (*Database) CheckBufferAccountLatest

func (db *Database) CheckBufferAccountLatest(address string, currentSlot uint64) bool

CheckBufferAccountLatest implements the db.StakeCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckMultisigLatest

func (db *Database) CheckMultisigLatest(address string, currentSlot uint64) bool

CheckMultisigLatest implements the db.TokenCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckNonceAccountLatest

func (db *Database) CheckNonceAccountLatest(address string, currentSlot uint64) bool

CheckNonceAccountLatest implements the db.SystemCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckProgramAccountLatest

func (db *Database) CheckProgramAccountLatest(address string, currentSlot uint64) bool

CheckProgramAccountLatest implements the db.StakeCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckProgramDataAccountLatest

func (db *Database) CheckProgramDataAccountLatest(address string, currentSlot uint64) bool

CheckProgramDataAccountLatest implements the db.StakeCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckStakeAccountLatest

func (db *Database) CheckStakeAccountLatest(address string, currentSlot uint64) bool

CheckStakeAccountLatest implements the db.StakeCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckTokenAccountLatest

func (db *Database) CheckTokenAccountLatest(address string, currentSlot uint64) bool

CheckTokenAccountLatest implements the db.TokenCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckTokenDelegateLatest

func (db *Database) CheckTokenDelegateLatest(sourceAddress string, currentSlot uint64) bool

CheckDelegateLatest implements the db.TokenCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckTokenLatest

func (db *Database) CheckTokenLatest(address string, currentSlot uint64) bool

CheckTokenLatest implements the db.TokenCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckTokenSupplyLatest

func (db *Database) CheckTokenSupplyLatest(address string, currentSlot uint64) bool

CheckTokenSupplyLatest implements the db.TokenCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) CheckValidatorLatest

func (db *Database) CheckValidatorLatest(address string, currentSlot uint64) bool

CheckStakeAccountLatest implements the db.StakeCheckerDb if error, it returns false since there is no address statement inside database

func (*Database) Close

func (db *Database) Close()

Close implements db.Database

func (*Database) CreateInstructionPartition

func (db *Database) CreateInstructionPartition(id int) error

CreateInstructionsPartition implements db.InstructionDb

func (*Database) CreateTxPartition

func (db *Database) CreateTxPartition(Id int) error

CreateTxPartition implements db.TxDb

func (*Database) DeleteBufferAccount

func (db *Database) DeleteBufferAccount(address string) error

DeleteBufferAccount implements the db.BpfLoaderDb

func (*Database) DeleteNonceAccount

func (db *Database) DeleteNonceAccount(address string) error

DeleteNonceAccount implements the db.SystemDb

func (*Database) DeleteProgramAccount

func (db *Database) DeleteProgramAccount(address string) error

DeleteProgramAccount implements the db.BpfLoaderDb

func (*Database) DeleteProgramDataAccount

func (db *Database) DeleteProgramDataAccount(address string) error

DeleteProgramDataAccount implements the db.BpfLoaderDb

func (*Database) DeleteStakeAccount

func (db *Database) DeleteStakeAccount(address string) error

DeleteStakeAccount implements the db.StakeDb

func (*Database) DeleteStakeDelegation

func (db *Database) DeleteStakeDelegation(address string) error

DeleteStakeDelegation implements the db.StakeDb

func (*Database) DeleteTokenAccount

func (db *Database) DeleteTokenAccount(address string) error

DeleteTokenAccount implements the db.TokenDb

func (*Database) DeleteTokenDelegation

func (db *Database) DeleteTokenDelegation(address string) error

DeleteTokenDelegation implements the db.TokenDb

func (*Database) DeleteValidator

func (db *Database) DeleteValidator(address string) error

DeleteValidator implements the db.VoteDb

func (*Database) Exec

func (db *Database) Exec(sql string, args ...interface{}) (sql.Result, error)

func (*Database) GetBlockHourAgo

func (db *Database) GetBlockHourAgo(now time.Time) (dbtypes.BlockRow, bool, error)

func (*Database) GetEpochProducedBlocks

func (db *Database) GetEpochProducedBlocks(epoch uint64) ([]uint64, error)

GetEpochProducedBlocks implements the db.VoteDb

func (*Database) GetHistoryBlock

func (db *Database) GetHistoryBlock(history time.Time) (dbtypes.BlockRow, bool, error)

func (*Database) GetLastBlock

func (db *Database) GetLastBlock() (dbtypes.BlockRow, error)

func (*Database) GetMissingHeight

func (db *Database) GetMissingHeight(start uint64, end uint64) (height uint64, err error)

func (*Database) GetMissingSlotRange

func (db *Database) GetMissingSlotRange(height uint64) (start uint64, end uint64, err error)

func (*Database) GetTokenUnits

func (db *Database) GetTokenUnits() ([]dbtypes.TokenUnitRow, error)

func (*Database) HasBlock

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

HasBlock implements db.BlockDb

func (*Database) InsertBatch

func (db *Database) InsertBatch(insertStmt string, conflictStmt string, params []interface{}, paramsNumber int) error

func (*Database) PruneInstructionsBeforeSlot

func (db *Database) PruneInstructionsBeforeSlot(slot uint64) error

PruneInstructionsBeforeSlot implements db.InstructionDb

func (*Database) PruneTxsBeforeSlot

func (db *Database) PruneTxsBeforeSlot(slot uint64) error

PruneTxsBeforeSlot implements db.TxDb

func (*Database) Query

func (db *Database) Query(sql string, args ...interface{}) (*sql.Rows, error)

func (*Database) SaveAccountBalances

func (db *Database) SaveAccountBalances(slot uint64, accounts []string, balances []uint64) error

func (*Database) SaveAccountHistoryBalances

func (db *Database) SaveAccountHistoryBalances(timestamp time.Time, accounts []string, balances []uint64) error

func (*Database) SaveAccountHistoryTokenBalances

func (db *Database) SaveAccountHistoryTokenBalances(timestamp time.Time, accounts []string, balances []uint64) error

func (*Database) SaveAccountTokenBalances

func (db *Database) SaveAccountTokenBalances(slot uint64, accounts []string, balances []uint64) error

func (*Database) SaveAverageSlotTimePerHour

func (db *Database) SaveAverageSlotTimePerHour(slot uint64, averageTime float64) error

func (*Database) SaveBlock

func (db *Database) SaveBlock(block dbtypes.BlockRow) error

SaveBlock implements db.BlockDb

func (*Database) SaveBufferAccount

func (db *Database) SaveBufferAccount(account dbtypes.BufferAccountRow) error

SaveBufferAccount implements the db.BpfLoaderDb

func (*Database) SaveHistoryTokenPrices

func (db *Database) SaveHistoryTokenPrices(prices []dbtypes.TokenPriceRow) error

SaveTokensPrices implements db.PriceDb

func (*Database) SaveHistoryValidatorSkipRates

func (db *Database) SaveHistoryValidatorSkipRates(skipRates []dbtypes.ValidatorSkipRateRow) error

SaveValidatorSkipRates implements the db.VoteDb

func (*Database) SaveInstructions

func (db *Database) SaveInstructions(instructions []dbtypes.InstructionRow) error

SaveInstructions implements db.InstructionDb

func (*Database) SaveMultisig

func (db *Database) SaveMultisig(multisig dbtypes.MultisigRow) error

SaveMultisig implements the db.TokenDb

func (*Database) SaveNonceAccount

func (db *Database) SaveNonceAccount(
	account dbtypes.NonceAccountRow,
) error

SaveNonceAccount implements the db.SystemDb

func (*Database) SaveProgramAccount

func (db *Database) SaveProgramAccount(account dbtypes.ProgramAccountRow) error

SaveProgramAccount implements the db.BpfLoaderDb

func (*Database) SaveProgramDataAccount

func (db *Database) SaveProgramDataAccount(account dbtypes.ProgramDataAccountRow) error

SaveProgramDataAccount implements the db.BpfLoaderDb

func (*Database) SaveStakeAccount

func (db *Database) SaveStakeAccount(account dbtypes.StakeAccountRow) error

SaveStake implements the db.StakeDb

func (*Database) SaveStakeDelegation

func (db *Database) SaveStakeDelegation(delegation dbtypes.StakeDelegationRow) error

SaveStakeDelegation implements the db.StakeDb

func (*Database) SaveStakeLockup

func (db *Database) SaveStakeLockup(lockup dbtypes.StakeLockupRow) error

SaveStakeLockup implements the db.StakeDb

func (*Database) SaveSupplyInfo

func (db *Database) SaveSupplyInfo(supply dbtypes.SupplyInfoRow) error

func (*Database) SaveToken

func (db *Database) SaveToken(
	token dbtypes.TokenRow,
) error

SaveToken implements the db.TokenDb

func (*Database) SaveTokenAccount

func (db *Database) SaveTokenAccount(account dbtypes.TokenAccountRow) error

SaveTokenAccount implements the db.TokenDb

func (*Database) SaveTokenDelegation

func (db *Database) SaveTokenDelegation(delegation dbtypes.TokenDelegationRow) error

SaveTokenDelegate implements the db.TokenDb

func (*Database) SaveTokenPrices

func (db *Database) SaveTokenPrices(prices []dbtypes.TokenPriceRow) error

SaveTokensPrices allows to save the given prices as the most updated ones

func (*Database) SaveTokenSupply

func (db *Database) SaveTokenSupply(supply dbtypes.TokenSupplyRow) error

SaveTokenSupply implements the db.TokenDb

func (*Database) SaveTokenUnits

func (db *Database) SaveTokenUnits(units []dbtypes.TokenUnitRow) error

func (*Database) SaveTxs

func (db *Database) SaveTxs(txs []dbtypes.TxRow) error

SaveTxs implements db.TxDb

func (*Database) SaveValidator

func (db *Database) SaveValidator(account dbtypes.VoteAccountRow) error

SaveValidator implements the db.VoteDb

func (*Database) SaveValidatorConfig

func (db *Database) SaveValidatorConfig(row dbtypes.ValidatorConfigRow) error

SaveValidatorConfig implements the db.ConfigDb

func (*Database) SaveValidatorSkipRates

func (db *Database) SaveValidatorSkipRates(skipRates []dbtypes.ValidatorSkipRateRow) error

SaveValidatorSkipRates implements the db.VoteDb

func (*Database) SaveValidatorStatuses

func (db *Database) SaveValidatorStatuses(statuses []dbtypes.ValidatorStatusRow) error

SaveValidatorStatuses implements the db.VoteDb

Jump to

Keyboard shortcuts

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