op

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	X = 0
	Y = 1
	Z = 2
)

Variables

This section is empty.

Functions

func Upstream

func Upstream(selector *Selector, derefLast bool, refLast bool) func(state *est.State) unsafe.Pointer

Types

type Discoveryable added in v0.2.0

type Discoveryable interface {
	Discover(aFunc interface{}) (func(operands []*Operand, state *est.State) (interface{}, error), reflect.Type, bool)
}

Discoveryable allows optimizing method calls. if receiver T, receives args T1,T2 then it is possible to do type assertion like follow actual, ok := aFunc.(func(receiver T, a1 T1, a2 T2))

type DiscoveryableIface added in v0.2.0

type DiscoveryableIface interface {
	DiscoverInterfaces(aFunc interface{}) (func(args ...interface{}) (interface{}, error), reflect.Type, bool)
}

type Expression

type Expression struct {
	LiteralPtr *unsafe.Pointer
	Type       reflect.Type
	*Selector
	est.New
	Unify converter.UnifyFn
}

func NewExpression

func NewExpression(selector *Selector) *Expression

func (*Expression) Operand

func (e *Expression) Operand(control est.Control, options ...interface{}) (*Operand, error)

type Expressions

type Expressions []*Expression

func (Expressions) Operands

func (e Expressions) Operands(control est.Control, shouldDerefLast bool) ([]*Operand, error)

type Func

type Func struct {
	Name       string
	XType      *xunsafe.Type
	Literal    unsafe.Pointer
	ResultType reflect.Type
	Function   Funeexpression
	// contains filtered or unexported fields
}

func (*Func) CallFunc added in v0.2.0

func (f *Func) CallFunc(accumulator *Selector, operands []*Operand, state *est.State) unsafe.Pointer

type Function added in v0.2.0

type Function struct {
	Handler     interface{}
	ResultTyper func(call *expr.Call) (reflect.Type, error)
}

type Functions

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

func EmptyFunctions added in v0.2.0

func EmptyFunctions() *Functions

func NewFunctions

func NewFunctions(options ...interface{}) *Functions

func (*Functions) FuncSelector added in v0.2.0

func (f *Functions) FuncSelector(name string, parent *Selector) (*Selector, bool)

func (*Functions) IsFuncNs added in v0.2.0

func (f *Functions) IsFuncNs(ns string) bool

func (*Functions) Method added in v0.2.0

func (f *Functions) Method(rType reflect.Type, id string, call *expr.Call) (*Func, error)

func (*Functions) NewFunc added in v0.2.0

func (f *Functions) NewFunc(name string, function interface{}, resultType reflect.Type) (*Func, error)

func (*Functions) RegisterFuncNs added in v0.2.0

func (f *Functions) RegisterFuncNs(ns string, funcs interface{}) error

func (*Functions) RegisterFunction

func (f *Functions) RegisterFunction(name string, function interface{}) error

func (*Functions) RegisterFunctionKind added in v0.2.0

func (f *Functions) RegisterFunctionKind(methodName string, funcDetails KindFunction) error

func (*Functions) RegisterStandaloneFunction added in v0.2.0

func (f *Functions) RegisterStandaloneFunction(name string, function *Function) error

func (*Functions) RegisterTypeFunc added in v0.2.0

func (f *Functions) RegisterTypeFunc(receiverType reflect.Type, typeFunc *TypeFunc) error

func (*Functions) TryDetectResultType added in v0.2.0

func (f *Functions) TryDetectResultType(prev *Selector, methodName string, call *expr.Call) (reflect.Type, error)

type FunctionsIndex added in v0.2.0

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

func (*FunctionsIndex) Add added in v0.2.0

func (i *FunctionsIndex) Add(name string, details KindFunction)

func (*FunctionsIndex) Get added in v0.2.0

func (i *FunctionsIndex) Get(id string) (KindFunction, bool)

type Funeexpression added in v0.2.0

type Funeexpression = func(operands []*Operand, state *est.State) (interface{}, error)

type Interface added in v0.2.0

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

func (*Interface) Exec added in v0.2.0

func (i *Interface) Exec(xPtr unsafe.Pointer, state *est.State) unsafe.Pointer

type KindFunction added in v0.2.0

type KindFunction interface {
	Kind() []reflect.Kind
	Handler() interface{}
}

type KindIndex added in v0.2.0

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

func (*KindIndex) Add added in v0.2.0

func (i *KindIndex) Add(name string, details KindFunction) error

func (*KindIndex) Get added in v0.2.0

func (i *KindIndex) Get(kind reflect.Kind) (*FunctionsIndex, bool)

func (*KindIndex) GetOrCreate added in v0.2.0

func (i *KindIndex) GetOrCreate(kind reflect.Kind) *FunctionsIndex

func (*KindIndex) KindFunction added in v0.2.0

func (i *KindIndex) KindFunction(kind reflect.Kind, id string) (KindFunction, bool)

type Map added in v0.2.0

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

func (*Map) Exec added in v0.2.0

func (m *Map) Exec(mapPtr unsafe.Pointer, state *est.State) unsafe.Pointer

type MethodResultTyper added in v0.2.0

type MethodResultTyper interface {
	MethodResultType(methodName string, call *expr.Call) (reflect.Type, error)
}

type Operand

type Operand struct {
	LiteralPtr *unsafe.Pointer
	Sel        *Selector
	Comp       est.Compute
	Type       reflect.Type
	XType      *xunsafe.Type

	NamedIFace bool
	// contains filtered or unexported fields
}

func (*Operand) AsInterface added in v0.2.0

func (o *Operand) AsInterface(valuePtr unsafe.Pointer) interface{}

func (*Operand) AsValue added in v0.2.0

func (o *Operand) AsValue(valuePtr unsafe.Pointer) interface{}

func (*Operand) Exec

func (o *Operand) Exec(state *est.State) unsafe.Pointer

func (*Operand) ExecInterface added in v0.2.0

func (o *Operand) ExecInterface(state *est.State) interface{}

func (*Operand) ExecReflectValue added in v0.2.0

func (o *Operand) ExecReflectValue(state *est.State) reflect.Value

func (*Operand) IsIndirect

func (o *Operand) IsIndirect() bool

func (*Operand) Pointer

func (o *Operand) Pointer(state *est.State) unsafe.Pointer

func (*Operand) SetType added in v0.2.0

func (o *Operand) SetType(rType reflect.Type)

func (*Operand) SetUnifier added in v0.2.0

func (o *Operand) SetUnifier(x converter.UnifyFn)

type ResultTyper added in v0.2.0

type ResultTyper interface {
	ResultType(receiver reflect.Type, call *expr.Call) (reflect.Type, error)
}

type Selector

type Selector struct {
	ID   string
	Type reflect.Type
	*xunsafe.Field
	Indirect bool
	Parent   *Selector
	Literal  unsafe.Pointer

	Func            *Func
	Slice           *Slice
	Args            []*Operand
	Placeholder     string
	ParentOffset    uintptr
	Map             *Map
	InterfaceExec   *Interface
	Cycle           *Selector
	IsFieldSelector bool
}

Selector represent data selector

func FunctionSelector

func FunctionSelector(id string, field *xunsafe.Field, aFunc *Func, parent *Selector) *Selector

func NewCycleSelector added in v0.2.0

func NewCycleSelector(id string, field *xunsafe.Field, parent *Selector, indirect bool, offset uintptr, cycleSelector *Selector) *Selector

func NewInterfaceSelector added in v0.2.0

func NewInterfaceSelector(id string, placeholder string, xOperand, indexOperand *Operand, parent *Selector) (*Selector, error)

func NewLiteralSelector added in v0.2.0

func NewLiteralSelector(id string, sType reflect.Type, value interface{}, parent *Selector) *Selector

func NewMapSelector added in v0.2.0

func NewMapSelector(id string, placeholder string, mapOperand, indexOperand *Operand, parent *Selector) (*Selector, error)

func NewSelector

func NewSelector(id, name string, sType reflect.Type, parent *Selector) *Selector

NewSelector create a selector

func SelectorWithField

func SelectorWithField(id string, field *xunsafe.Field, parent *Selector, indirect bool, offset uintptr) *Selector

func SliceSelector added in v0.2.0

func SliceSelector(id string, placeholder string, sliceOperand, indexOperand *Operand, parent *Selector) (*Selector, error)

type Selectors

type Selectors struct {
	Index map[string]int
	// contains filtered or unexported fields
}

func NewSelectors

func NewSelectors() *Selectors

func (*Selectors) Append

func (s *Selectors) Append(sel *Selector) error

func (*Selectors) ById

func (s *Selectors) ById(selectorId string) (*Selector, bool)

func (*Selectors) Selector

func (s *Selectors) Selector(index int) *Selector

func (*Selectors) Selectors

func (s *Selectors) Selectors() []*Selector

func (*Selectors) Snapshot added in v0.2.0

func (s *Selectors) Snapshot() *Selectors

type ShouldDerefLast added in v0.2.0

type ShouldDerefLast bool

type ShouldRefLast added in v0.2.0

type ShouldRefLast bool

type Slice added in v0.2.0

type Slice struct {
	XSlice       *xunsafe.Slice
	IndexOperand *Operand
	SliceOperand *Operand
	ToInter      converter.UnifyFn
}

func (*Slice) Exec added in v0.2.0

func (s *Slice) Exec(slicePtr unsafe.Pointer, state *est.State) unsafe.Pointer

type TypeFunc added in v0.2.0

type TypeFunc struct {
	Name       string
	Handler    interface{}
	ResultType reflect.Type
}

Jump to

Keyboard shortcuts

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