Documentation ¶
Index ¶
- func LoadVariableBytes(contentType string, b []byte) (scope.Variables, error)
- func LoadVariables(uri *url.URL, opts ...IndexOptions) (scope.Variables, error)
- func ReadDirFiles(dirpath string) (map[string][]byte, error)
- type IndexOptions
- type Script
- type VM
- func (vm *VM) Eval() (*hil.EvaluationResult, error)
- func (vm *VM) FuncNames() []string
- func (vm *VM) Parse(script string) (err error)
- func (vm *VM) ParseEval(script string, vars scope.Variables) (result *hil.EvaluationResult, err error)
- func (vm *VM) RegisterFunc(name string, f ast.Function) error
- func (vm *VM) SetVars(vars map[string]ast.Variable)
- func (vm *VM) VarNames() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadVariableBytes ¶
LoadVariableBytes loads an index from the given bytes.
func LoadVariables ¶
LoadVariables loads an index from the URL. It reads the data, parses and indexes the data structure
Types ¶
type IndexOptions ¶
type IndexOptions struct { // Content type of context data ContentType string }
IndexOptions are index loader options
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
Script is an evaluatable script
func NewScriptBytes ¶
NewScriptBytes this simply removes the shabang line if one is specified
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM is used to parse and eval a given script
func (*VM) Eval ¶
func (vm *VM) Eval() (*hil.EvaluationResult, error)
Eval evaluates a parsed script. Parse must be called before a call to Eval can be made
func (*VM) ParseEval ¶
func (vm *VM) ParseEval(script string, vars scope.Variables) (result *hil.EvaluationResult, err error)
ParseEval is a helper function to set variables, parse the script and evaluate it
func (*VM) RegisterFunc ¶
RegisterFunc registers a function to the vm
Click to show internal directories.
Click to hide internal directories.