Documentation ¶
Index ¶
- Constants
- func CommandNodeType() mesh.NodeType
- func Decide(m mesh.Node, input interface{}) error
- func DecisionNodeType() mesh.NodeType
- func DestinationNodeType() mesh.NodeType
- func ExecuteCommand(m mesh.Node, input interface{}) error
- func ExecuteNodes(nodes []mesh.Node, input interface{}, executorName string) error
- func GetCommandFromMap(content map[string]interface{}) interface{}
- func GetDecisionFromMap(content map[string]interface{}) interface{}
- func GetDestinationFromMap(content map[string]interface{}) interface{}
- func NewCommandNode(title string, execFunction func(interface{}) (interface{}, error), ...) (mesh.Node, error)
- func NewDecisionNode(title string, execFunction func(interface{}) ([]string, error), ...) (mesh.Node, error)
- func NewDestinationNode(title string, execFunction func(interface{}) error, ...) (mesh.Node, error)
- func Terminate(m mesh.Node, input interface{}) error
- type Command
- type Decision
- type Destination
Constants ¶
const ( CommandType = "command" DecisionType = "decision" DestinationType = "destination" )
Variables ¶
This section is empty.
Functions ¶
func CommandNodeType ¶
func Decide ¶
Decide executes the decision command with the input. The input is expected to be unchanged. The outcome of a decision is a list of categories names. These categories are used to identify the next nodes to call.
func DecisionNodeType ¶
func DestinationNodeType ¶
func ExecuteCommand ¶
ExecuteCommand executes the command and checks if the input and return types match the expected types.
func ExecuteNodes ¶
func GetCommandFromMap ¶
func GetCommandFromMap(content map[string]interface{}) interface{}
func GetDecisionFromMap ¶
func GetDecisionFromMap(content map[string]interface{}) interface{}
func GetDestinationFromMap ¶
func GetDestinationFromMap(content map[string]interface{}) interface{}
func NewCommandNode ¶
func NewCommandNode(title string, execFunction func(interface{}) (interface{}, error), inputType, returnType interface{}) (mesh.Node, error)
NewCommandNode creates a new command node
func NewDecisionNode ¶
func NewDecisionNode(title string, execFunction func(interface{}) ([]string, error), valueType, returnType interface{}) (mesh.Node, error)
NewDecisionNode creates a new decision node.
Types ¶
type Command ¶
type Command struct { Name string `json:"name"` ExpectedInputType interface{} `json:"inputtype"` ExpectedReturnType interface{} `json:"returntype"` // contains filtered or unexported fields }
Command is a step in a branch of a decision tree. It is expected that execute function acquire and manipulate data to prepare a next Command, a Decision or a Destination.
type Decision ¶
type Decision struct { Name string `json:"name"` ExpectedValueType interface{} // contains filtered or unexported fields }
Decision divides a branch of a decision tree in to multiple subbranches. It is expected that decide function returns a list of categories names, which are used to identify the next nodes to call.
type Destination ¶
type Destination struct { Name string `json:"name"` ExpectedInputType interface{} // contains filtered or unexported fields }
Destination terminates a branch of a decision tree. It is expected that terminate function does an action to fulfill the purpose of the branch.