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) GetCheckpointCursor(ctx context.Context, id string) (seq uint64, found bool, err error)
- func (store *DBStore) InsertEvents(ctx context.Context, records []EventRecord) error
- func (store *DBStore) QueryEvents(ctx context.Context, eventAccountAddress, eventHandle string, ...) ([]EventRecord, error)
- func (store *DBStore) UpsertCheckpointCursor(ctx context.Context, id string, seq uint64) error
- type EventRecord
Constants ¶
View Source
const ( CreateSchema = ` CREATE SCHEMA IF NOT EXISTS sui; ` CreateEventsTable = `` /* 602-byte string literal not displayed */ CreateCheckpointCursorsTable = `` /* 163-byte string literal not displayed */ CreateIndices = `` /* 592-byte string literal not displayed */ InsertEvent = `` /* 285-byte string literal not displayed */ QueryEventsBase = `` /* 219-byte string literal not displayed */ GetCheckpointCursorQuery = ` SELECT last_sequence FROM sui.checkpoint_cursors WHERE id = $1 ` // UpsertCheckpointCursorQuery is monotonic: the stored sequence never regresses even if // callers race or submit stale values. UpsertCheckpointCursorQuery = `` /* 220-byte string literal not displayed */ )
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) GetCheckpointCursor ¶
func (store *DBStore) GetCheckpointCursor(ctx context.Context, id string) (seq uint64, found bool, err error)
GetCheckpointCursor returns the persisted last-processed checkpoint sequence for the given cursor id. found is false when no cursor has been persisted yet.
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)
func (*DBStore) UpsertCheckpointCursor ¶
UpsertCheckpointCursor persists the last-processed checkpoint sequence for the given cursor id. The stored value is monotonic: it never regresses to a lower sequence.
type EventRecord ¶
type EventRecord struct {
EventAccountAddress string
EventHandle string
// TxIndex is the position of the transaction within its checkpoint, as returned by the node.
// Together with (block_height, event_offset) it provides a total order across all events.
TxIndex uint64
EventOffset uint64
TxDigest string
BlockVersion uint64
BlockHeight string
BlockHash []byte
BlockTimestamp uint64
Data map[string]any
IsSynthetic bool
}
Click to show internal directories.
Click to hide internal directories.