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
- 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 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
Click to show internal directories.
Click to hide internal directories.