functions

package
v2.1.1-0...-182a82a Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArgumentDelimiter represents the character delimiting function arguments
	ArgumentDelimiter = ","
)

Variables

View Source
var FunctionPattern = regexp.MustCompile(`(\w+)\((.*)\)$`)

FunctionPattern is the matching pattern for custom defined functions

Functions

func DefineFunctions

func DefineFunctions(ctx *broker.Context, functions Stack, node *specs.Node, flow specs.FlowInterface) error

DefineFunctions defined all properties within the given functions

func GenerateStackReference

func GenerateStackReference() string

GenerateStackReference generates a unique path prefix which could be used to isolate functions

func PrepareCallFunctions

func PrepareCallFunctions(ctx *broker.Context, node *specs.Node, flow specs.FlowInterface, mem Collection, functions Custom, call *specs.Call) error

PrepareCallFunctions prepares the function definitions inside the given flow

func PrepareFlowFunctions

func PrepareFlowFunctions(ctx *broker.Context, mem Collection, functions Custom, flow specs.FlowInterface) (err error)

PrepareFlowFunctions prepares the functions definitions inside the given flow

func PrepareFunction

func PrepareFunction(ctx *broker.Context, node *specs.Node, flow specs.FlowInterface, property *specs.Property, stack Stack, methods Custom) error

PrepareFunction attempts to parses the given function

func PrepareFunctions

func PrepareFunctions(ctx *broker.Context, mem Collection, functions Custom, flows specs.FlowListInterface) (err error)

PrepareFunctions prepares all function definitions inside the given flows

func PrepareHeaderFunctions

func PrepareHeaderFunctions(ctx *broker.Context, flow specs.FlowInterface, stack Stack, header specs.Header, functions Custom) error

PrepareHeaderFunctions prepares the function definitions inside the given header

func PrepareNodeFunctions

func PrepareNodeFunctions(ctx *broker.Context, mem Collection, functions Custom, flow specs.FlowInterface, node *specs.Node) (err error)

PrepareNodeFunctions prepares the available functions within the given node

func PrepareParameterMapFunctions

func PrepareParameterMapFunctions(ctx *broker.Context, node *specs.Node, flow specs.FlowInterface, stack Stack, params *specs.ParameterMap, functions Custom) error

PrepareParameterMapFunctions prepares the function definitions inside the given parameter map

func PrepareParamsFunctions

func PrepareParamsFunctions(ctx *broker.Context, node *specs.Node, flow specs.FlowInterface, stack Stack, params map[string]*specs.Property, functions Custom) error

PrepareParamsFunctions prepares the function definitions inside the given property

func PreparePropertyFunctions

func PreparePropertyFunctions(ctx *broker.Context, node *specs.Node, flow specs.FlowInterface, stack Stack, prop *specs.Property, functions Custom) error

PreparePropertyFunctions prepares the function definitions inside the given property

Types

type Collection

type Collection map[*specs.ParameterMap]Stack

Collection represents a collection of stacks grouped by nodes

func (Collection) Load

func (collection Collection) Load(params *specs.ParameterMap) Stack

Load attempts to load the function stack for the given parameter map

func (Collection) Reserve

func (collection Collection) Reserve(params *specs.ParameterMap) Stack

Reserve reserves a new function stack for the given node. If a stack already exists for the given node is it returned.

type Custom

type Custom map[string]Intermediate

Custom represents a collection of custom defined functions that could be called inside a template

type ErrUndefinedFunction

type ErrUndefinedFunction struct {
	Function string
	Property string
}

ErrUndefinedFunction occurs when custom function is not defined in property but referenced

func (ErrUndefinedFunction) Error

func (e ErrUndefinedFunction) Error() string

Error returns a description of the given error as a string

func (ErrUndefinedFunction) Prettify

func (e ErrUndefinedFunction) Prettify() prettyerr.Error

Prettify returns the prettified version of the given error

type Exec

type Exec func(store references.Store) error

Exec is a executable function. A store should be returned which could be used to encode the function property

type Function

type Function struct {
	Arguments []*specs.Property
	Fn        Exec
	Returns   *specs.Property
}

Function represents a custom defined function

type Intermediate

type Intermediate func(args ...*specs.Property) (*specs.Property, Exec, error)

Intermediate prepares the custom defined function. The given arguments represent the exprected types that are passed when called. Properties returned should be absolute.

type Stack

type Stack map[string]*Function

Stack represents a collection of functions

Directories

Path Synopsis
lib
jwt

Jump to

Keyboard shortcuts

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