Documentation ¶
Index ¶
- Constants
- Variables
- func Error(err error, msg string) error
- func Errorf(err error, format string, args ...interface{}) error
- func Errors(err ...error) error
- func ForEach(ctx context.Context, iter Iterator, ...) error
- func IsNil(input interface{}) bool
- func IsNoMoreData(err error) bool
- func IsTypeOf(value Value, check Type) bool
- func NewRootScope() (*Scope, CloseFunc)
- func NumberBoundaries(input float64) (max float64, min float64)
- func NumberLowerBoundary(input float64) float64
- func NumberUpperBoundary(input float64) float64
- func ParamsFrom(ctx context.Context) (map[string]Value, error)
- func ParamsWith(ctx context.Context, params map[string]Value) context.Context
- func Random(max float64, min float64) float64
- func SourceError(src SourceMap, err error) error
- func TypeError(actual Type, expected ...Type) error
- func ValidateArgs(args []Value, minimum, maximum int) error
- func ValidateType(value Value, required ...Type) error
- func ValidateValueTypePairs(pairs ...PairValueType) error
- type BaseType
- type Cloneable
- type CloseFunc
- type Expression
- type Function
- type Functions
- type Getter
- type Iterable
- type Iterator
- type Namespace
- type OperatorExpression
- type PairValueType
- type RootScope
- type Scope
- func (s *Scope) Fork() *Scope
- func (s *Scope) GetVariable(name string) (Value, error)
- func (s *Scope) HasVariable(name string) bool
- func (s *Scope) MustGetVariable(name string) Value
- func (s *Scope) SetVariable(name string, val Value) error
- func (s *Scope) UpdateVariable(name string, val Value) error
- type Setter
- type SourceMap
- type Type
- type Value
Constants ¶
const MaxArgs = 65536
Variables ¶
var ( ErrMissedArgument = errors.New("missed argument") ErrInvalidArgument = errors.New("invalid argument") ErrInvalidArgumentNumber = errors.New("invalid argument number") ErrInvalidType = errors.New("invalid type") ErrInvalidOperation = errors.New("invalid operation") ErrNotFound = errors.New("not found") ErrNotUnique = errors.New("not unique") ErrTerminated = errors.New("operation is terminated") ErrUnexpected = errors.New("unexpected error") ErrTimeout = errors.New("operation timed out") ErrNotImplemented = errors.New("not implemented") ErrNotSupported = errors.New("not supported") ErrNoMoreData = errors.New("no more data") )
Functions ¶
func IsNoMoreData ¶ added in v0.8.0
func IsTypeOf ¶
IsTypeOf return true when value's type is equal to check type. Returns false, otherwise.
func NewRootScope ¶
func NumberBoundaries ¶ added in v0.8.0
func NumberLowerBoundary ¶ added in v0.9.0
func NumberUpperBoundary ¶ added in v0.9.0
func SourceError ¶
func ValidateArgs ¶
func ValidateType ¶
ValidateType checks the match of value's type and required types.
func ValidateValueTypePairs ¶ added in v0.5.0
func ValidateValueTypePairs(pairs ...PairValueType) error
ValidateValueTypePairs validate pairs of Values and Types. Returns error when type didn't match
Types ¶
type Expression ¶
type Functions ¶ added in v0.8.0
type Functions struct {
// contains filtered or unexported fields
}
Functions is a container for functions.
func NewFunctions ¶ added in v0.10.0
func NewFunctions() *Functions
NewFunctions returns new empty Functions.
func NewFunctionsFromMap ¶ added in v0.10.0
NewFunctionsFromMap creates new Functions from map, where key is the name of the function and value is the function.
func (*Functions) Get ¶ added in v0.10.0
Get returns the function with the given name. If the function does not exist it returns nil, false.
type Getter ¶ added in v0.6.0
Getter represents an interface of complex types that needs to be used to read values by path. The interface is created to let user-defined types be used in dot notation data access.
type Iterable ¶ added in v0.7.0
Iterable represents an interface of a value that can be iterated by using an iterator.
type Iterator ¶ added in v0.7.0
Iterator represents an interface of a value iterator. When iterator is exhausted it must return None as a value.
type OperatorExpression ¶
type PairValueType ¶ added in v0.5.0
PairValueType is a supporting structure that used in validateValueTypePairs.
func NewPairValueType ¶ added in v0.10.0
func NewPairValueType(value Value, types ...Type) PairValueType
NewPairValueType it's a shortcut for creating a new PairValueType.
The common pattern of using PairValueType is: ```
pairs := []core.PairValueType{ core.PairValueType{args[0], []core.Type{types.String}}, // go vet warning core.PairValueType{Value: args[1], Types: []core.Type{types.Binary}}, // too long }
``` With NewPairValueType there is no need to type `[]core.Type{...}` and code becomes more readable and maintainable.
That is how the code above looks like with NewPairValueType: ```
pairs := []core.PairValueType{ core.NewPairValueType(args[0], types.String), core.NewPairValueType(args[1], types.Binary), }
```
type RootScope ¶ added in v0.5.0
type RootScope struct {
// contains filtered or unexported fields
}
func (*RootScope) AddDisposable ¶ added in v0.5.0
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
func (*Scope) HasVariable ¶
func (*Scope) MustGetVariable ¶ added in v0.5.0
type Setter ¶ added in v0.6.0
Setter represents an interface of complex types that needs to be used to write values by path. The interface is created to let user-defined types be used in dot notation assignment.
type SourceMap ¶
type SourceMap struct {
// contains filtered or unexported fields
}