compiler

package
v0.0.0-...-af92ede Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package compiler implements a flow execution engine defined by map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(def *defn.FlowDef) process.Instance

Compile compile the definition into a runnabl instance.

Types

type AssignmentNode

type AssignmentNode struct {
	*defn.Assignment
}

AssignmentNode the node to execute a variable assignment.

func (*AssignmentNode) Execute

func (n *AssignmentNode) Execute(inst process.Instance) error

Execute execute the node.

func (*AssignmentNode) GetName

func (n *AssignmentNode) GetName() string

GetName get the name of the node.

type Context

type Context struct {
	VariableMap map[string]process.Variable
}

Context the context.

func (*Context) Eval

func (ctx *Context) Eval(expr string) interface{}

Eval evaluate the given expression.

func (*Context) Get

func (ctx *Context) Get(name string) process.Variable

Get get the variable of the context.

type DecisionNode

type DecisionNode struct {
	*defn.Decision
}

DecisionNode the execution node for decisions.

func (*DecisionNode) Execute

func (n *DecisionNode) Execute(inst process.Instance) error

Execute execute the decision.

func (*DecisionNode) GetName

func (n *DecisionNode) GetName() string

GetName get the name of the decision node.

type EndNode

type EndNode struct{}

EndNode the end node.

func (*EndNode) Execute

func (n *EndNode) Execute(inst process.Instance) error

Execute to set the state to `completed`.

func (*EndNode) GetName

func (n *EndNode) GetName() string

GetName get the name of the end node.

type Flow

type Flow struct {
	Name    string
	NodeMap map[string]process.Node
}

Flow the flow definition.

func (*Flow) GetName

func (f *Flow) GetName() string

GetName get the name of the flow.

func (*Flow) GetNode

func (f *Flow) GetNode(name string) process.Node

GetNode get the node definition.

type Instance

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

Instance the instance.

func (*Instance) GetContext

func (inst *Instance) GetContext() process.Context

GetContext get the context of the process instance.

func (*Instance) GetFlow

func (inst *Instance) GetFlow() process.Flow

GetFlow get the flow definition of the process instance.

func (*Instance) GetState

func (inst *Instance) GetState() process.State

GetState get the state of the instance.

type Variable

type Variable struct {
	*defn.Variable
	// contains filtered or unexported fields
}

Variable the simple variable.

func (*Variable) GetName

func (v *Variable) GetName() string

GetName get the name of the variable.

func (*Variable) GetValue

func (v *Variable) GetValue() interface{}

GetValue get the value.

func (*Variable) SetValue

func (v *Variable) SetValue(val interface{}) error

SetValue set the value.

Jump to

Keyboard shortcuts

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