protocols

package
v0.0.0-...-307fc59 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuiltinTypes

func GetBuiltinTypes() []types.Any

func Match

func Match(scope types.Scope, pattern string, target string) bool

func MaterializeToArray

func MaterializeToArray(ctx context.Context, scope types.Scope,
	stored_query types.StoredQuery) []types.Row

Types

type AddDispatcher

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

func (AddDispatcher) Add

func (self AddDispatcher) Add(scope types.Scope, a types.Any, b types.Any) types.Any

func (*AddDispatcher) AddImpl

func (self *AddDispatcher) AddImpl(elements ...AddProtocol)

func (AddDispatcher) Copy

func (self AddDispatcher) Copy() AddDispatcher

type AddProtocol

type AddProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Add(scope types.Scope, a types.Any, b types.Any) types.Any
}

Add protocol

type AssociativeDispatcher

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

func (*AssociativeDispatcher) AddImpl

func (self *AssociativeDispatcher) AddImpl(elements ...AssociativeProtocol)

When adding external protocols they need to be considered before any built in protocols so they are able to override the built ins. Therefore add them to the front of the protocols array.

func (*AssociativeDispatcher) Associative

func (self *AssociativeDispatcher) Associative(
	scope types.Scope, a types.Any, b types.Any) (types.Any, bool)

func (AssociativeDispatcher) Copy

func (*AssociativeDispatcher) GetMembers

func (self *AssociativeDispatcher) GetMembers(
	scope types.Scope, a types.Any) []string

type AssociativeProtocol

type AssociativeProtocol interface {
	Applicable(a types.Any, b types.Any) bool

	// Returns a value obtained by dereferencing field b from
	// object a. If not present return pres == false and possibly
	// a default value in res. If no default is present res must
	// be nil.
	Associative(scope types.Scope, a types.Any, b types.Any) (res types.Any, pres bool)
	GetMembers(scope types.Scope, a types.Any) []string
}

Associative protocol.

func NewLazyStructWrapper

func NewLazyStructWrapper(
	base types.Any, attributes ...string) AssociativeProtocol

type BoolDispatcher

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

func (*BoolDispatcher) AddImpl

func (self *BoolDispatcher) AddImpl(elements ...BoolProtocol)

func (BoolDispatcher) Bool

func (self BoolDispatcher) Bool(ctx context.Context, scope types.Scope, a types.Any) bool

func (BoolDispatcher) Copy

func (self BoolDispatcher) Copy() BoolDispatcher

type BoolProtocol

type BoolProtocol interface {
	Applicable(a types.Any) bool
	Bool(ctx context.Context, scope types.Scope, a types.Any) bool
}

This protocol implements the truth value.

type DefaultAssociative

type DefaultAssociative struct{}

Last resort associative - uses reflect package to resolve struct fields.

func (DefaultAssociative) Applicable

func (self DefaultAssociative) Applicable(a types.Any, b types.Any) bool

func (DefaultAssociative) Associative

func (self DefaultAssociative) Associative(scope types.Scope, a types.Any, b types.Any) (res types.Any, pres bool)

func (DefaultAssociative) GetMembers

func (self DefaultAssociative) GetMembers(scope types.Scope, a types.Any) []string

Get the members which are callable by VFilter.

type DivDispatcher

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

func (*DivDispatcher) AddImpl

func (self *DivDispatcher) AddImpl(elements ...DivProtocol)

func (DivDispatcher) Copy

func (self DivDispatcher) Copy() DivDispatcher

func (DivDispatcher) Div

func (self DivDispatcher) Div(scope types.Scope, a types.Any, b types.Any) types.Any

type DivProtocol

type DivProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Div(scope types.Scope, a types.Any, b types.Any) types.Any
}

Divtiply protocol

type EqDispatcher

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

func (*EqDispatcher) AddImpl

func (self *EqDispatcher) AddImpl(elements ...EqProtocol)

func (EqDispatcher) Copy

func (self EqDispatcher) Copy() EqDispatcher

func (EqDispatcher) Eq

func (self EqDispatcher) Eq(scope types.Scope, a types.Any, b types.Any) bool

type EqProtocol

type EqProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Eq(scope types.Scope, a types.Any, b types.Any) bool
}

Eq protocol

type GtDispatcher

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

func (*GtDispatcher) AddImpl

func (self *GtDispatcher) AddImpl(elements ...GtProtocol)

func (GtDispatcher) Copy

func (self GtDispatcher) Copy() GtDispatcher

func (GtDispatcher) Gt

func (self GtDispatcher) Gt(scope types.Scope, a types.Any, b types.Any) bool

type GtProtocol

type GtProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Gt(scope types.Scope, a types.Any, b types.Any) bool
}

Less than protocol

type IterateDispatcher

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

The Iterator protocol allows types to be iterated over.

func (*IterateDispatcher) AddImpl

func (self *IterateDispatcher) AddImpl(elements ...IterateProtocol)

func (IterateDispatcher) Copy

func (IterateDispatcher) Iterate

func (self IterateDispatcher) Iterate(
	ctx context.Context, scope types.Scope, a types.Any) <-chan types.Row

type IterateProtocol

type IterateProtocol interface {
	Applicable(a types.Any) bool
	Iterate(ctx context.Context, scope types.Scope, a types.Any) <-chan types.Row
}

This protocol implements the truth value.

type LazyFunctionWrapper

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

func (*LazyFunctionWrapper) MarshalJSON

func (self *LazyFunctionWrapper) MarshalJSON() ([]byte, error)

func (*LazyFunctionWrapper) Reduce

func (self *LazyFunctionWrapper) Reduce(ctx context.Context) types.Any

func (*LazyFunctionWrapper) ReduceWithScope

func (self *LazyFunctionWrapper) ReduceWithScope(
	ctx context.Context, scope types.Scope) types.Any

type LazyWrapper

type LazyWrapper struct {
	Type         reflect.Type
	IndirectType reflect.Type
	Attributes   []string
	Methods      []string
}

This is a lazy wrapper around an object providing getters to property calls.

func (LazyWrapper) Applicable

func (self LazyWrapper) Applicable(a types.Any, b types.Any) bool

func (LazyWrapper) Associative

func (self LazyWrapper) Associative(scope types.Scope, a types.Any, b types.Any) (res types.Any, pres bool)

func (LazyWrapper) GetMembers

func (self LazyWrapper) GetMembers(scope types.Scope, a types.Any) []string

func (LazyWrapper) InAttributes

func (self LazyWrapper) InAttributes(name string) bool

type LtDispatcher

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

func (*LtDispatcher) AddImpl

func (self *LtDispatcher) AddImpl(elements ...LtProtocol)

func (LtDispatcher) Copy

func (self LtDispatcher) Copy() LtDispatcher

func (LtDispatcher) Lt

func (self LtDispatcher) Lt(scope types.Scope, a types.Any, b types.Any) bool

type LtProtocol

type LtProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Lt(scope types.Scope, a types.Any, b types.Any) bool
}

Less than protocol

type MembershipDispatcher

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

func (*MembershipDispatcher) AddImpl

func (self *MembershipDispatcher) AddImpl(elements ...MembershipProtocol)

func (MembershipDispatcher) Copy

func (MembershipDispatcher) Membership

func (self MembershipDispatcher) Membership(scope types.Scope, a types.Any, b types.Any) bool

type MembershipProtocol

type MembershipProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Membership(scope types.Scope, a types.Any, b types.Any) bool
}

Membership protocol (the "in" operator)

type MulDispatcher

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

func (*MulDispatcher) AddImpl

func (self *MulDispatcher) AddImpl(elements ...MulProtocol)

func (MulDispatcher) Copy

func (self MulDispatcher) Copy() MulDispatcher

func (MulDispatcher) Mul

func (self MulDispatcher) Mul(scope types.Scope, a types.Any, b types.Any) types.Any

type MulProtocol

type MulProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Mul(scope types.Scope, a types.Any, b types.Any) types.Any
}

Multiply protocol

type RegexDispatcher

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

func (*RegexDispatcher) AddImpl

func (self *RegexDispatcher) AddImpl(elements ...RegexProtocol)

func (RegexDispatcher) Copy

func (self RegexDispatcher) Copy() RegexDispatcher

func (RegexDispatcher) Match

func (self RegexDispatcher) Match(scope types.Scope, pattern types.Any, target types.Any) bool

type RegexProtocol

type RegexProtocol interface {
	Applicable(pattern types.Any, target types.Any) bool
	Match(scope types.Scope, pattern types.Any, target types.Any) bool
}

Regex Match protocol

type SubDispatcher

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

func (*SubDispatcher) AddImpl

func (self *SubDispatcher) AddImpl(elements ...SubProtocol)

func (SubDispatcher) Copy

func (self SubDispatcher) Copy() SubDispatcher

func (SubDispatcher) Sub

func (self SubDispatcher) Sub(scope types.Scope, a types.Any, b types.Any) types.Any

type SubProtocol

type SubProtocol interface {
	Applicable(a types.Any, b types.Any) bool
	Sub(scope types.Scope, a types.Any, b types.Any) types.Any
}

Sub protocol

Jump to

Keyboard shortcuts

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