Documentation
¶
Overview ¶
Package db provides the database for the consumer service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsumerDB ¶
type ConsumerDB interface {
ConsumerDBWriter
ConsumerDBReader
}
ConsumerDB is the interface for the ConsumerDB.
type ConsumerDBReader ¶
type ConsumerDBReader interface {
// GetUint64 gets a uint64 for a given query.
GetUint64(ctx context.Context, query string) (uint64, error)
// GetFloat64 gets a float64 out of the database
GetFloat64(ctx context.Context, query string) (float64, error)
// GetStringArray gets an array of strings from a given query.
GetStringArray(ctx context.Context, query string) ([]string, error)
// GetTxCounts gets the counts for each of tx_hash from a given query.
GetTxCounts(ctx context.Context, query string) ([]*model.TransactionCountResult, error)
// GetTokenCounts gets the counts for each of token address from a given query.
GetTokenCounts(ctx context.Context, query string) ([]*model.TokenCountResult, error)
// GetBridgeEvent returns a bridge event.
GetBridgeEvent(ctx context.Context, query string) (*sql.BridgeEvent, error)
// GetBridgeEvents returns a bridge event.
GetBridgeEvents(ctx context.Context, query string) ([]sql.BridgeEvent, error)
// GetAllBridgeEvents returns a bridge event.
GetAllBridgeEvents(ctx context.Context, query string) ([]sql.HybridBridgeEvent, error)
// GetAllMessageBusEvents returns a bridge event.
GetAllMessageBusEvents(ctx context.Context, query string) ([]sql.HybridMessageBusEvent, error)
// GetDateResults gets day by day data for a given query.
GetDateResults(ctx context.Context, query string) ([]*model.DateResult, error)
// GetAddressRanking gets AddressRanking for a given query.
GetAddressRanking(ctx context.Context, query string) ([]*model.AddressRanking, error)
// GetDailyTotals gets the daily stats for each date broken down by chain
GetDailyTotals(ctx context.Context, query string) ([]*model.DateResultByChain, error)
// GetRankedChainsByVolume gets the volume for each chain
GetRankedChainsByVolume(ctx context.Context, query string) ([]*model.VolumeByChainID, error)
}
ConsumerDBReader is the interface for reading events from the ConsumerDB. nolint:interfacebloat
type ConsumerDBWriter ¶
type ConsumerDBWriter interface {
// StoreEvent stores an event.
StoreEvent(ctx context.Context, event interface{}) error
// StoreEvents stores a list of events.
StoreEvents(ctx context.Context, events []interface{}) error
// StoreLastBlock stores the last block number that has been backfilled for a given chain.
StoreLastBlock(ctx context.Context, chainID uint32, blockNumber uint64, contractAddress string) error
// StoreTokenIndex stores the token index data.
StoreTokenIndex(ctx context.Context, chainID uint32, tokenIndex uint8, tokenAddress string, contractAddress string) error
// StoreSwapFee stores the swap fee data.
StoreSwapFee(ctx context.Context, chainID uint32, timestamp uint64, contractAddress string, fee uint64, feeType string) error
// UNSAFE_DB gets the underlying gorm db. This is not intended for use in production.
//
//nolint:golint
UNSAFE_DB() *gorm.DB
}
ConsumerDBWriter is the interface for writing to the ConsumerDB.
Click to show internal directories.
Click to hide internal directories.