Documentation ¶
Index ¶
- Constants
- Variables
- func DeepCopy(i interface{}) interface{}
- func Resolve(rootScope interface{}, currentTask string, expr *typedvalues.TypedValue) (*typedvalues.TypedValue, error)
- type DeepCopier
- type Function
- type InputFn
- type InvocationScope
- type JavascriptExpressionParser
- type ObjectMetadata
- type OutputFn
- type OutputHeadersFn
- type ParamFn
- type Resolver
- type Scope
- type Store
- type TaskFn
- type TaskScope
- type Tasks
- type UidFn
- type WorkflowScope
Constants ¶
const (
ResolvingTimeout = time.Duration(100) * time.Millisecond
)
Variables ¶
var ( ErrTimeOut = errors.New("expression resolver timed out") DefaultResolver = NewJavascriptExpressionParser() )
var BuiltinFunctions = map[string]Function{ "uid": &UidFn{}, "input": &InputFn{}, "output": &OutputFn{}, "param": &ParamFn{}, "task": &TaskFn{}, "outputHeaders": &OutputHeadersFn{}, }
Built-in functions for the expression parser
var (
ErrMergeTypeMismatch = errors.New("cannot merge incompatible types")
)
Functions ¶
func Resolve ¶
func Resolve(rootScope interface{}, currentTask string, expr *typedvalues.TypedValue) (*typedvalues.TypedValue, error)
Types ¶
type DeepCopier ¶
type DeepCopier interface {
DeepCopy() DeepCopier
}
type Function ¶
Function is an interface for providing functions that are able to be injected into the Otto runtime.
type InputFn ¶
type InputFn struct{}
InputFn provides a function to get the input of a task for the given key. If no key is provided, the default key is used.
type InvocationScope ¶
type InvocationScope struct { *ObjectMetadata Inputs map[string]interface{} }
InvocationScope object provides information about the current invocation.
func (*InvocationScope) DeepCopy ¶
func (s *InvocationScope) DeepCopy() DeepCopier
type JavascriptExpressionParser ¶
type JavascriptExpressionParser struct {
// contains filtered or unexported fields
}
func NewJavascriptExpressionParser ¶
func NewJavascriptExpressionParser() *JavascriptExpressionParser
func (*JavascriptExpressionParser) Resolve ¶
func (oe *JavascriptExpressionParser) Resolve(rootScope interface{}, currentTask string, expr *typedvalues.TypedValue) (*typedvalues.TypedValue, error)
type ObjectMetadata ¶
ObjectMetadata contains identity and meta-data about an object.
func (*ObjectMetadata) DeepCopy ¶
func (s *ObjectMetadata) DeepCopy() DeepCopier
type OutputHeadersFn ¶
type OutputHeadersFn struct{}
OutputHeadersFn provides a function to Get headers in the output of a task.
func (*OutputHeadersFn) Apply ¶
func (qf *OutputHeadersFn) Apply(vm *otto.Otto, call otto.FunctionCall) otto.Value
Apply gets headers in the output of a task. If no argument is provided the output of the current task is returned.
type ParamFn ¶
type ParamFn struct{}
ParmFn provides a function to get the invocation param for the given key. If no key is provided, the default key is used.
type Resolver ¶
type Resolver interface {
Resolve(rootScope interface{}, currentTask string, expr *typedvalues.TypedValue) (*typedvalues.TypedValue, error)
}
resolver resolves an expression within a given context/scope.
type Scope ¶
type Scope struct { Workflow *WorkflowScope Invocation *InvocationScope Tasks Tasks }
Scope is the broadest view of the workflow invocation, which can be queried by the user.
func NewScope ¶
func NewScope(base *Scope, wfi *types.WorkflowInvocation) (*Scope, error)
NewScope creates a new scope given the workflow invocation and its associates workflow definition.
func (*Scope) DeepCopy ¶
func (s *Scope) DeepCopy() DeepCopier
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
TODO Keep old states (but prune if OOM) TODO provide garbage collector
type TaskFn ¶
type TaskFn struct{}
TaskFn provides a function to get a task for the given taskId. If no argument is provided the current task is returned.
type TaskScope ¶
type TaskScope struct { *ObjectMetadata Status string // TaskInvocation status UpdatedAt int64 // unix timestamp Inputs map[string]interface{} Requires map[string]*types.TaskDependencyParameters Output interface{} OutputHeaders interface{} Function string }
TaskScope holds information about a specific task execution within the current workflow invocation.
func (*TaskScope) DeepCopy ¶
func (s *TaskScope) DeepCopy() DeepCopier
type WorkflowScope ¶
type WorkflowScope struct { *ObjectMetadata UpdatedAt int64 // unix timestamp Status string // workflow status Name string Internal bool }
WorkflowScope provides information about the workflow definition.
func (*WorkflowScope) DeepCopy ¶
func (s *WorkflowScope) DeepCopy() DeepCopier