vm

package
v0.0.0-...-261b5b0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2016 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

VM implements the virtual machine runtime/evaluator for the SQL, FilterQL, and Expression evalutors.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownOp       = fmt.Errorf("expr: unknown op type")
	ErrUnknownNodeType = fmt.Errorf("expr: unknown node type")
	ErrExecute         = fmt.Errorf("Could not execute")

	SchemaInfoEmpty = &NoSchema{}
)

Functions

func Eval

func Eval(ctx expr.EvalContext, arg expr.Node) (value.Value, bool)

func EvalFilerSelect

func EvalFilerSelect(sel *rel.FilterSelect, inc Includer, writeContext expr.ContextWriter, readContext expr.ContextReader) (bool, error)

EvalFilerSelect applies a FilterSelect statement to the specified contexts

@writeContext = Write results of projection
@readContext  = Message input, ie evaluate for Where/Filter clause

func EvalSql

func EvalSql(sel *rel.SqlSelect, writeContext expr.ContextWriter, readContext expr.ContextReader) (bool, error)

Eval applies a sql statement to the specified context

@writeContext = Write out results of projection
@readContext  = Message to evaluate does it match where clause?  if so proceed to projection

func LikeCompare

func LikeCompare(a, b string) (value.BoolValue, bool)

func NewFilterVm

func NewFilterVm(i Includer) *filterql

Types

type EvalBaseContext

type EvalBaseContext struct {
	expr.ContextReader
}

type EvaluatorFunc

type EvaluatorFunc func(ctx expr.EvalContext) (value.Value, bool)

func Evaluator

func Evaluator(arg expr.Node) EvaluatorFunc

type ExprVm

type ExprVm interface {
	Execute(writeContext expr.ContextWriter, readContext expr.ContextReader) error
}

type Includer

type Includer interface {
	Include(name string) (*rel.FilterStatement, error)
}

Includer defines an interface used for resolving INCLUDE clauses into a *FilterStatement. Implementations should return an error if the name cannot be resolved.

type NoSchema

type NoSchema struct {
}

func (*NoSchema) Key

func (m *NoSchema) Key() string

type State

type State struct {
	ExprVm // reference to the VM operating on this state

	expr.ContextReader
	Writer expr.ContextWriter
	// contains filtered or unexported fields
}

func NewState

func NewState(vm ExprVm, read expr.ContextReader, write expr.ContextWriter) *State

func (*State) Walk

func (e *State) Walk(arg expr.Node) (value.Value, bool)

type Vm

type Vm struct {
	*expr.Tree
}

A node vm is a vm for parsing, evaluating a single tree-node

func NewVm

func NewVm(exprText string) (*Vm, error)

func (*Vm) Execute

func (m *Vm) Execute(writeContext expr.ContextWriter, readContext expr.ContextReader) (err error)

Execute applies a parse expression to the specified context's

func (*Vm) MarshalJSON

func (m *Vm) MarshalJSON() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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