Documentation
¶
Index ¶
- type BoolExpression
- type BoolOperator
- type CursorDirection
- type Expression
- func And(expressions ...Expression) Expression
- func Block(block string, operator primitives.ComparisonOperator) Expression
- func Comparator(name string, valueComparators ...primitives.ValueComparator) Expression
- func Confidence(confLevel primitives.ConfidenceLevel) Expression
- func Or(expressions ...Expression) Expression
- func Timestamp(timestamp uint64, operator primitives.ComparisonOperator) Expression
- func TxHash(txHash string) Expression
- type KeyFilter
- func IndexedSequencesByBlockRangeKeyFilter(readName string, start, end string, comparatorName string, values []string) KeyFilter
- func IndexedSequencesByTxHashKeyFilter(readName, txHash string) KeyFilter
- func IndexedSequencesCreatedAfterKeyFilter(readName string, comparatorName string, values []string, timestamp time.Time, ...) KeyFilter
- func IndexedSequencesKeyFilter(readName string, comparatorName string, values []string, ...) KeyFilter
- func IndexedSequencesValueGreaterThanKeyFilter(readName string, comparatorName, value string, ...) KeyFilter
- func IndexedSequencesValueRangeKeyFilter(readName string, comparatorName string, min, max string, ...) KeyFilter
- func SequencesByBlockRangeKeyFilter(readName string, start, end string) KeyFilter
- func SequencesCreatedAfterKeyFilter(readName string, timestamp time.Time, confidence primitives.ConfidenceLevel) KeyFilter
- func Where(key string, expressions ...Expression) (KeyFilter, error)
- type Limit
- type LimitAndSort
- type SortBy
- type SortByBlock
- type SortBySequence
- type SortByTimestamp
- type SortDirection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolExpression ¶
type BoolExpression struct { // should have minimum length of two Expressions []Expression BoolOperator }
BoolExpression allows nesting of boolean expressions with different BoolOperator's.
type BoolOperator ¶
type BoolOperator int
const ( AND BoolOperator = iota OR )
func (BoolOperator) String ¶
func (op BoolOperator) String() string
type CursorDirection ¶
type CursorDirection int32
const ( CursorPrevious CursorDirection = iota + 1 CursorFollowing )
type Expression ¶
type Expression struct { Primitive primitives.Primitive BoolExpression BoolExpression }
Expression contains either a Primitive or a BoolExpression.
func And ¶
func And(expressions ...Expression) Expression
func Block ¶
func Block(block string, operator primitives.ComparisonOperator) Expression
func Comparator ¶
func Comparator(name string, valueComparators ...primitives.ValueComparator) Expression
Comparator is used for filtering through specific key values. e.g. of filtering for key that belongs to a token transfer by values: Comparator("transferValue", [{"150",LTE}, {"300",GTE}])
func Confidence ¶
func Confidence(confLevel primitives.ConfidenceLevel) Expression
func Or ¶
func Or(expressions ...Expression) Expression
func Timestamp ¶
func Timestamp(timestamp uint64, operator primitives.ComparisonOperator) Expression
func TxHash ¶
func TxHash(txHash string) Expression
func (Expression) IsPrimitive ¶
func (expr Expression) IsPrimitive() bool
type KeyFilter ¶
type KeyFilter struct { // Key points to the underlying chain contract address and some data that belongs to that contract. // Depending on the underlying Contract Reader blockchain implementation key can map to different onchain concepts, but should be able to map differing onchain data to same offchain data if they belong to the same key. Key string // The base Expressions slice indicates AND logical operation over expressions, which can be primitives or nested boolean expressions. // For eg. []Expression{primitive, primitive, BoolExpression{AND, primitive, BoolExpression{OR, primitive, primitive}} is primitive AND primitive AND (primitive AND (primitive OR primitive)). Expressions []Expression }
KeyFilter is used to filter down chain specific data related to a key.
func IndexedSequencesByBlockRangeKeyFilter ¶ added in v0.4.0
func IndexedSequencesByBlockRangeKeyFilter( readName string, start, end string, comparatorName string, values []string, ) KeyFilter
IndexedSequencesByBlockRangeKeyFilter creates a KeyFilter that filters sequences for the provided property values at the specified property name. Value filters are 'OR'ed together and results are limited by provided cursor range. A read name is the value that identifies the sequence type. The signature property name is the sequence property to apply the filter to and the sequence values are the individual values to search for in the provided property.
func IndexedSequencesByTxHashKeyFilter ¶ added in v0.4.0
IndexedSequencesByTxHashKeyFilter creates a KeyFilter that filters logs for the provided transaction hash. A sequence read name is the value that identifies the sequence type.
func IndexedSequencesCreatedAfterKeyFilter ¶ added in v0.4.0
func IndexedSequencesCreatedAfterKeyFilter( readName string, comparatorName string, values []string, timestamp time.Time, confidence primitives.ConfidenceLevel, ) KeyFilter
IndexedSequencesCreatedAfterKeyFilter creates a KeyFilter that filters sequences for the provided property and values created after the provided time value. Sequence property values filters are 'OR'ed. A sequence read name is the value that identifies the sequence type.
func IndexedSequencesKeyFilter ¶ added in v0.4.0
func IndexedSequencesKeyFilter( readName string, comparatorName string, values []string, confidence primitives.ConfidenceLevel, ) KeyFilter
IndexedSequencesKeyFilter creates a KeyFilter that filters logs for the provided sequence property values at the specified property name. Sequence value filters are 'OR'ed together. A sequence read name is the value that identifies the sequence type. The signature value name is the sequence property to apply the filter to and the sequence values are the individual values to search for in the provided property.
func IndexedSequencesValueGreaterThanKeyFilter ¶ added in v0.4.0
func IndexedSequencesValueGreaterThanKeyFilter( readName string, comparatorName, value string, confidence primitives.ConfidenceLevel, ) KeyFilter
IndexedSequencesValueGreaterThanKeyFilter creates a KeyFilter that filters sequences for the provided property value and name at or above the specified confidence level. A sequence read name is the value that identifies the sequence type. The property name is the sequence property to apply the filter to and the value is the individual value to search for in the provided property.
func IndexedSequencesValueRangeKeyFilter ¶ added in v0.4.0
func IndexedSequencesValueRangeKeyFilter( readName string, comparatorName string, min, max string, confidence primitives.ConfidenceLevel, ) KeyFilter
IndexedSequencesValueRangeKeyFilter creates a KeyFilter that filters logs on the provided sequence property between the provided min and max, endpoints inclusive. A sequence read name is the value that identifies the sequence type.
func SequencesByBlockRangeKeyFilter ¶ added in v0.4.0
SequencesByBlockRangeKeyFilter creates a KeyFilter that filters sequences for the provided block range, endpoints inclusive.
func SequencesCreatedAfterKeyFilter ¶ added in v0.4.0
func SequencesCreatedAfterKeyFilter( readName string, timestamp time.Time, confidence primitives.ConfidenceLevel, ) KeyFilter
SequencesCreatedAfterKeyFilter creates a KeyFilter that filters sequences for after but not equal to the provided time value.
func Where ¶
func Where(key string, expressions ...Expression) (KeyFilter, error)
Where is a helper function for building KeyFilter, eg. usage:
queryFilter, err := Where( "key", TxHash("0xHash"), Block(startBlock, Gte), Block(endBlock, Lte), Or( And( Timestamp(someTs1, Gte), Timestamp(otherTs1, Lte)), And( Timestamp(someTs2, Gte), Timestamp(otherTs2, Lte)), ), ) Equals:`txHash = '0xHash' AND block > startBlock AND block < endBlock AND ((timestamp > someTs1 And timestamp < otherTs1) OR (timestamp > someTs2 And timestamp < otherTs2))`
type Limit ¶
type Limit struct { Cursor string CursorDirection CursorDirection Count uint64 }
func CountLimit ¶
func CursorLimit ¶
func CursorLimit(cursor string, cursorDirection CursorDirection, count uint64) Limit
type LimitAndSort ¶
func NewLimitAndSort ¶
func NewLimitAndSort(limit Limit, sortBy ...SortBy) LimitAndSort
func (LimitAndSort) HasCursorLimit ¶
func (p LimitAndSort) HasCursorLimit() bool
func (LimitAndSort) HasSequenceSort ¶
func (p LimitAndSort) HasSequenceSort() bool
type SortBy ¶
type SortBy interface {
GetDirection() SortDirection
}
type SortByBlock ¶
type SortByBlock struct {
// contains filtered or unexported fields
}
func NewSortByBlock ¶
func NewSortByBlock(sortDir SortDirection) SortByBlock
func (SortByBlock) GetDirection ¶
func (o SortByBlock) GetDirection() SortDirection
type SortBySequence ¶
type SortBySequence struct {
// contains filtered or unexported fields
}
func NewSortBySequence ¶
func NewSortBySequence(sortDir SortDirection) SortBySequence
func (SortBySequence) GetDirection ¶
func (o SortBySequence) GetDirection() SortDirection
type SortByTimestamp ¶
type SortByTimestamp struct {
// contains filtered or unexported fields
}
func NewSortByTimestamp ¶
func NewSortByTimestamp(sortDir SortDirection) SortByTimestamp
func (SortByTimestamp) GetDirection ¶
func (o SortByTimestamp) GetDirection() SortDirection