db

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockEventsAlreadyIndexed

func BlockEventsAlreadyIndexed(blockHeight int64, chainID uint, db *gorm.DB) (bool, error)

func CreateParserError

func CreateParserError(db *gorm.DB, blockEvent models.BlockEvent, parser models.BlockEventParser, parserError error) error

func FindOrCreateCustomParsers

func FindOrCreateCustomParsers(db *gorm.DB, parsers map[string]models.BlockEventParser) error

func GetAddresses

func GetAddresses(addressList []string, db *gorm.DB) ([]models.Address, error)

func GetBlockByHeight

func GetBlockByHeight(db *gorm.DB, height int64) models.Block

func GetBlocksFromStart

func GetBlocksFromStart(db *gorm.DB, chainID uint, startHeight int64, endHeight int64) ([]models.Block, error)

func GetDBChainID

func GetDBChainID(db *gorm.DB, chain models.Chain) (uint, error)

func GetFailedBlocks

func GetFailedBlocks(db *gorm.DB, chainID uint) []models.FailedBlock

func GetFirstMissingBlockInRange

func GetFirstMissingBlockInRange(db *gorm.DB, start, end int64, chainID uint) int64

func GetHighestEventIndexedBlock

func GetHighestEventIndexedBlock(db *gorm.DB, chainID uint) (models.Block, error)

func GetHighestIndexedBlock

func GetHighestIndexedBlock(db *gorm.DB, chainID uint) models.Block

func IndexCustomBlockEvents

func IndexCustomBlockEvents(conf config.IndexConfig, db *gorm.DB, blockDBWrapper *BlockDBWrapper, identifierLoggingString string, beginBlockParserTrackers map[string]models.BlockEventParser, endBlockParserTrackers map[string]models.BlockEventParser) error

func MigrateInterfaces

func MigrateInterfaces(db *gorm.DB, interfaces []any) error

func MigrateModels

func MigrateModels(db *gorm.DB) error

MigrateModels runs the gorm automigrations with all the db models. This will migrate as needed and do nothing if nothing has changed.

func PostgresDbConnect

func PostgresDbConnect(host string, port string, database string, user string, password string, level string) (*gorm.DB, error)

PostgresDbConnect connects to the database according to the passed in parameters

func PostgresDbConnectLogInfo

func PostgresDbConnectLogInfo(host string, port string, database string, user string, password string) (*gorm.DB, error)

PostgresDbConnect connects to the database according to the passed in parameters

func UpsertFailedBlock

func UpsertFailedBlock(db *gorm.DB, blockHeight int64, chainID string, chainName string) error

func UpsertFailedEventBlock

func UpsertFailedEventBlock(db *gorm.DB, blockHeight int64, chainID string, chainName string) error

Types

type BlockDBWrapper

type BlockDBWrapper struct {
	Block                         *models.Block
	BeginBlockEvents              []BlockEventDBWrapper
	EndBlockEvents                []BlockEventDBWrapper
	UniqueBlockEventTypes         map[string]models.BlockEventType
	UniqueBlockEventAttributeKeys map[string]models.BlockEventAttributeKey
}

func IndexBlockEvents

func IndexBlockEvents(db *gorm.DB, blockDBWrapper *BlockDBWrapper) (*BlockDBWrapper, error)

type BlockEventDBWrapper

type BlockEventDBWrapper struct {
	BlockEvent               models.BlockEvent
	Attributes               []models.BlockEventAttribute
	BlockEventParsedDatasets []parsers.BlockEventParsedData
}

type DenomDBWrapper

type DenomDBWrapper struct {
	Denom models.Denom
}

type MessageDBWrapper

type MessageDBWrapper struct {
	Message       models.Message
	MessageEvents []MessageEventDBWrapper
}

type MessageEventDBWrapper

type MessageEventDBWrapper struct {
	MessageEvent models.MessageEvent
	Attributes   []models.MessageEventAttribute
}

type TxDBWrapper

type TxDBWrapper struct {
	Tx                         models.Tx
	Messages                   []MessageDBWrapper
	UniqueMessageTypes         map[string]models.MessageType
	UniqueMessageEventTypes    map[string]models.MessageEventType
	UniqueMessageAttributeKeys map[string]models.MessageEventAttributeKey
}

func IndexNewBlock

func IndexNewBlock(db *gorm.DB, block models.Block, txs []TxDBWrapper, indexerConfig config.IndexConfig) (models.Block, []TxDBWrapper, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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