primitives

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 1 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Block    string
	Operator ComparisonOperator
}

Block is a primitive of KeyFilter that filters search in comparison to block number.

func (*Block) Accept

func (f *Block) Accept(visitor Visitor)

type Comparator

type Comparator struct {
	Name             string
	ValueComparators []ValueComparator
}

Comparator is used to filter over values that belong to key data.

func (*Comparator) Accept

func (f *Comparator) Accept(visitor Visitor)

type ComparisonOperator

type ComparisonOperator int
const (
	Eq ComparisonOperator = iota
	Neq
	Gt
	Lt
	Gte
	Lte
)

func (ComparisonOperator) String added in v0.3.0

func (cmpOp ComparisonOperator) String() string

type Confidence

type Confidence struct {
	ConfidenceLevel
}

Confidence is a primitive of KeyFilter that filters search to results that have a certain level of finalization. Confidence maps to different concepts on different blockchains.

func (*Confidence) Accept

func (f *Confidence) Accept(visitor Visitor)

type ConfidenceLevel

type ConfidenceLevel string
const (
	Finalized   ConfidenceLevel = "finalized"
	Unconfirmed ConfidenceLevel = "unconfirmed"
)

func ConfidenceLevelFromString added in v0.3.0

func ConfidenceLevelFromString(value string) (ConfidenceLevel, error)

type Primitive

type Primitive interface {
	Accept(visitor Visitor)
}

Primitive is the basic building block for KeyFilter.

type Timestamp

type Timestamp struct {
	Timestamp uint64
	Operator  ComparisonOperator
}

Timestamp is a primitive of KeyFilter that filters search in comparison to timestamp.

func (*Timestamp) Accept

func (f *Timestamp) Accept(visitor Visitor)

type TxHash

type TxHash struct {
	TxHash string
}

TxHash is a primitive of KeyFilter that filters search to results that contain txHash.

func (*TxHash) Accept

func (f *TxHash) Accept(visitor Visitor)

type ValueComparator

type ValueComparator struct {
	Value    any
	Operator ComparisonOperator
}

type Visitor

type Visitor interface {
	Comparator(primitive Comparator)
	Block(primitive Block)
	Confidence(primitive Confidence)
	Timestamp(primitive Timestamp)
	TxHash(primitive TxHash)
}

Visitor should have a per chain per db type implementation that converts primitives to db queries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL