Documentation ¶
Overview ¶
The compiler package provides a compiler and Go runtime for a subset of the IFQL language. Only pure functions are supported by the compiler. A function is compiled and then may be called repeatedly with different arguments. The function must be pure meaning it has no side effects. Other language features are not supported.
This runtime is not portable by design. The runtime consists of Go types that have been constructed based on the IFQL function being compiled. Those types are not serializable and cannot be transported to other systems or environments. This design is intended to limit the scope under which compilation must be supported.
Index ¶
- type CompilationCache
- type Evaluator
- type Func
- type Object
- func (o *Object) Bool() bool
- func (o *Object) Float() float64
- func (o *Object) Get(name string) Value
- func (o *Object) Int() int64
- func (o *Object) Object() *Object
- func (o *Object) Regexp() *regexp.Regexp
- func (o *Object) Set(name string, v Value)
- func (o *Object) SetPropertyType(name string, t semantic.Type)
- func (o *Object) Str() string
- func (o *Object) Time() Time
- func (o *Object) Type() semantic.Type
- func (o *Object) UInt() uint64
- type Scope
- func (s Scope) GetBool(name string) bool
- func (s Scope) GetFloat(name string) float64
- func (s Scope) GetInt(name string) int64
- func (s Scope) GetObject(name string) *Object
- func (s Scope) GetRegexp(name string) *regexp.Regexp
- func (s Scope) GetString(name string) string
- func (s Scope) GetTime(name string) Time
- func (s Scope) GetUInt(name string) uint64
- func (s Scope) Set(name string, v Value)
- func (s Scope) Type(name string) semantic.Type
- type Time
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompilationCache ¶
type CompilationCache struct {
// contains filtered or unexported fields
}
CompilationCache caches compilation results based on the types of the input parameters.
func NewCompilationCache ¶
func NewCompilationCache(fn *semantic.FunctionExpression) *CompilationCache
type Func ¶
type Func interface { Type() semantic.Type Eval(scope Scope) (Value, error) EvalBool(scope Scope) (bool, error) EvalInt(scope Scope) (int64, error) EvalUInt(scope Scope) (uint64, error) EvalFloat(scope Scope) (float64, error) EvalString(scope Scope) (string, error) EvalRegexp(scope Scope) (*regexp.Regexp, error) EvalTime(scope Scope) (Time, error) EvalObject(scope Scope) (*Object, error) }