Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRangeOperation ¶
IsRangeOperation returns a boolean signifying if a query Operator is a range operation or not.
func LookForRangesWithHeight ¶
func LookForRangesWithHeight(conditions []syntax.Condition) (queryRange QueryRanges, indexes []int, heightRange QueryRange)
LookForRangesWithHeight returns a mapping of QueryRanges and the matching indexes in the provided query conditions.
Types ¶
type BlockIndexer ¶
type BlockIndexer interface { // Has returns true if the given height has been indexed. An error is returned // upon database query failure. Has(height int64) (bool, error) // Index indexes FinalizeBlock events for a given block by its height. Index(events types.EventDataNewBlockEvents) error // Search performs a query for block heights that match a given FinalizeBlock // event search criteria. Search(ctx context.Context, q *query.Query) ([]int64, error) SetLogger(l log.Logger) Prune(retainHeight int64) (int64, int64, error) SetRetainHeight(retainHeight int64) error GetRetainHeight() (int64, error) }
BlockIndexer defines an interface contract for indexing block events.
type QueryRange ¶
type QueryRange struct { LowerBound any // int || time.Time UpperBound any // int || time.Time Key string IncludeLowerBound bool IncludeUpperBound bool }
QueryRange defines a range within a query condition.
func (QueryRange) AnyBound ¶
func (qr QueryRange) AnyBound() any
AnyBound returns either the lower bound if non-nil, otherwise the upper bound.
func (QueryRange) LowerBoundValue ¶
func (qr QueryRange) LowerBoundValue() any
LowerBoundValue returns the value for the lower bound. If the lower bound is nil, nil will be returned.
func (QueryRange) UpperBoundValue ¶
func (qr QueryRange) UpperBoundValue() any
UpperBoundValue returns the value for the upper bound. If the upper bound is nil, nil will be returned.
type QueryRanges ¶
type QueryRanges map[string]QueryRange
QueryRanges defines a mapping between a composite event key and a QueryRange.
e.g.account.number => queryRange{lowerBound: 1, upperBound: 5}.
func LookForRanges
deprecated
func LookForRanges(conditions []syntax.Condition) (ranges QueryRanges, indexes []int)
Deprecated: This function is not used anymore and will be replaced with LookForRangesWithHeight.