Documentation
¶
Index ¶
- Constants
- func BuildSQLCondition(expr query.Expression, args *[]any, argCount *int) (string, error)
- type DBStore
- func (store *DBStore) EnsureSchema(ctx context.Context) error
- func (store *DBStore) GetLatestOffset(ctx context.Context, eventAccountAddress, eventHandle string) (*models.EventId, uint64, error)
- func (store *DBStore) GetTotalCount(ctx context.Context, eventAccountAddress, eventHandle string) (uint64, error)
- func (store *DBStore) GetTxDigestByEventId(ctx context.Context, eventID uint64) (string, error)
- func (store *DBStore) InsertEvents(ctx context.Context, records []EventRecord) error
- func (store *DBStore) QueryEvents(ctx context.Context, eventAccountAddress, eventHandle string, ...) ([]EventRecord, error)
- type EventRecord
Constants ¶
View Source
const ( CreateSchema = ` CREATE SCHEMA IF NOT EXISTS sui; ` CreateEventsTable = `` /* 428-byte string literal not displayed */ CreateIndices = `` /* 331-byte string literal not displayed */ InsertEvent = `` /* 249-byte string literal not displayed */ QueryEventsBase = `` /* 544-byte string literal not displayed */ QueryEventsOffset = `` /* 198-byte string literal not displayed */ CountEvents = ` SELECT COUNT(*) as total_count FROM sui.events WHERE event_account_address = $1 AND event_handle = $2 ` GetTxDigestById = ` SELECT tx_digest FROM sui.events WHERE id = $1 ` )
View Source
const (
MaxEventsQueryLimit = 2000
)
Variables ¶
This section is empty.
Functions ¶
func BuildSQLCondition ¶
Taken from the Aptos ChainReader DB methods: https://github.com/smartcontractkit/chainlink-aptos/blob/develop/relayer/chainreader/db/db.go#L257
Types ¶
type DBStore ¶
type DBStore struct {
// contains filtered or unexported fields
}
func NewDBStore ¶
func NewDBStore(ds sqlutil.DataSource, lgr logger.Logger) *DBStore
func (*DBStore) GetLatestOffset ¶
func (store *DBStore) GetLatestOffset(ctx context.Context, eventAccountAddress, eventHandle string) (*models.EventId, uint64, error)
GetLatestOffset returns a cursor (of type EventId) based on the latest event recorded in the DB for a given type
func (*DBStore) GetTotalCount ¶
func (store *DBStore) GetTotalCount(ctx context.Context, eventAccountAddress, eventHandle string) (uint64, error)
GetTotalCount returns the total number of events recorded in the DB for a given type
func (*DBStore) GetTxDigestByEventId ¶
func (*DBStore) InsertEvents ¶
func (store *DBStore) InsertEvents(ctx context.Context, records []EventRecord) error
func (*DBStore) QueryEvents ¶
func (store *DBStore) QueryEvents(ctx context.Context, eventAccountAddress, eventHandle string, expressions []query.Expression, limitAndSort query.LimitAndSort) ([]EventRecord, error)
Click to show internal directories.
Click to hide internal directories.