filters

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRangeFilter

func GetRangeFilter(op, fName string) (func(a, b uint64) bool, error)

func GetStringFilter

func GetStringFilter(op, fName string) (func(s0, s1 string) bool, error)

func ParseNumberValue

func ParseNumberValue(value string) (uint64, error)

Types

type AccountBalanceFilter

type AccountBalanceFilter struct {
	// contains filtered or unexported fields
}

Filter for account balance. Ops: All

func (*AccountBalanceFilter) Configure

func (abf *AccountBalanceFilter) Configure(fd *FilterData) error

func (*AccountBalanceFilter) Match

func (abf *AccountBalanceFilter) Match(v interface{}) bool

type AccountCodeFilter

type AccountCodeFilter struct {
	// contains filtered or unexported fields
}

Filter for account code. Ops: == or != Could be used to match against nil, to see if an account is a contract account.

func (*AccountCodeFilter) Configure

func (acf *AccountCodeFilter) Configure(fd *FilterData) error

func (*AccountCodeFilter) Match

func (acf *AccountCodeFilter) Match(v interface{}) bool

type CompositeFilter

type CompositeFilter struct {
	// contains filtered or unexported fields
}

Filter made up of many filters.

func (*CompositeFilter) Match

func (cf *CompositeFilter) Match(v interface{}) bool

func (*CompositeFilter) SetData

func (cf *CompositeFilter) SetData(filters []Filter)

type ConfigurableFilter

type ConfigurableFilter interface {
	Filter
	Configure(*FilterData) error
}

A filter that can be configured with in-data.

type Filter

type Filter interface {
	Match(v interface{}) bool
}

Filters based on fields.

type FilterData

type FilterData struct {
	Field string `json:"field"`
	Op    string `json:"op"`
	Value string `json:"value"`
}

Used to filter. Op can be any of the following: The usual relative operators: <, >, <=, >=, ==, != (where applicable) A range parameter (see: https://help.github.com/articles/search-syntax/)

type FilterFactory

type FilterFactory struct {
	// contains filtered or unexported fields
}

Used to generate filters based on filter data. Keeping separate pools for "edge cases" (Composite and MatchAll)

func NewAccountFilterFactory

func NewAccountFilterFactory() *FilterFactory

TODO: [Silas] there are various notes about using mempool (which I guess translates to CheckTx cache). We need to understand if this is the right thing to do, since we cannot guarantee stability of the check cache it doesn't seem like the right thing to do....

func NewFilterFactory

func NewFilterFactory() *FilterFactory

func NewNameRegFilterFactory

func NewNameRegFilterFactory() *FilterFactory

func (*FilterFactory) NewFilter

func (ff *FilterFactory) NewFilter(fdArr []*FilterData) (Filter, error)

Creates a new filter given the input data array. If the array is zero length or nil, an empty filter will be returned that returns true on all matches. If the array is of size 1, a regular filter is returned, otherwise a CompositeFieldFilter is returned, which is a special filter that contains a number of other filters. It implements AccountFieldFilter, and will match an account only if all the sub-filters matches.

func (*FilterFactory) RegisterFilterPool

func (ff *FilterFactory) RegisterFilterPool(fieldName string, pool *sync.Pool)

type MatchAllFilter

type MatchAllFilter struct{}

Rubberstamps everything.

func (*MatchAllFilter) Match

func (maf *MatchAllFilter) Match(v interface{}) bool

type NameRegDataFilter

type NameRegDataFilter struct {
	// contains filtered or unexported fields
}

Filter for namereg data. Useful for example if you store an ipfs hash and know the hash but need the key. Ops: == or !=

func (*NameRegDataFilter) Configure

func (nrdf *NameRegDataFilter) Configure(fd *FilterData) error

func (*NameRegDataFilter) Match

func (nrdf *NameRegDataFilter) Match(v interface{}) bool

type NameRegExpiresFilter

type NameRegExpiresFilter struct {
	// contains filtered or unexported fields
}

Filter for expires. Ops: All

func (*NameRegExpiresFilter) Configure

func (nref *NameRegExpiresFilter) Configure(fd *FilterData) error

func (*NameRegExpiresFilter) Match

func (nref *NameRegExpiresFilter) Match(v interface{}) bool

type NameRegNameFilter

type NameRegNameFilter struct {
	// contains filtered or unexported fields
}

Filter for namereg name. This should not be used to get individual entries by name. Ops: == or !=

func (*NameRegNameFilter) Configure

func (nrnf *NameRegNameFilter) Configure(fd *FilterData) error

func (*NameRegNameFilter) Match

func (nrnf *NameRegNameFilter) Match(v interface{}) bool

type NameRegOwnerFilter

type NameRegOwnerFilter struct {
	// contains filtered or unexported fields
}

Filter for owner. Ops: == or !=

func (*NameRegOwnerFilter) Configure

func (nrof *NameRegOwnerFilter) Configure(fd *FilterData) error

func (*NameRegOwnerFilter) Match

func (nrof *NameRegOwnerFilter) Match(v interface{}) bool

Jump to

Keyboard shortcuts

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