Documentation
¶
Overview ¶
Package switch provides switch node factory for registry integration.
Package switch provides multi-way switch node implementation for workflow graph execution.
Index ¶
- Constants
- func NewSwitchNodeFactory() protocol.NodeFactory
- type SwitchCase
- type SwitchNode
- func (n *SwitchNode) Execute(ctx models.ExecutionContext, inputs map[string]models.NodeResult) (map[string]models.NodeResult, error)
- func (n *SwitchNode) ID() string
- func (n *SwitchNode) InputPorts() []models.InputPort
- func (n *SwitchNode) OutputPorts() []models.OutputPort
- func (n *SwitchNode) Type() string
- func (n *SwitchNode) Validate(config map[string]any) error
- type SwitchNodeFactory
Constants ¶
const ( OutputPortDefault = "default" OutputPortError = "error" InputPortMain = "main" )
Variables ¶
This section is empty.
Functions ¶
func NewSwitchNodeFactory ¶
func NewSwitchNodeFactory() protocol.NodeFactory
NewSwitchNodeFactory creates a new factory instance.
Types ¶
type SwitchCase ¶
SwitchCase represents a single case in the switch statement.
type SwitchNode ¶
type SwitchNode struct {
// contains filtered or unexported fields
}
SwitchNode implements the Node interface for multi-way branching Routes execution to different output ports based on a value.
func NewSwitchNode ¶
func NewSwitchNode(id string, config map[string]any) (*SwitchNode, error)
NewSwitchNode creates a new switch node.
func (*SwitchNode) Execute ¶
func (n *SwitchNode) Execute(ctx models.ExecutionContext, inputs map[string]models.NodeResult) (map[string]models.NodeResult, error)
Execute evaluates the value and routes to the matching output port.
func (*SwitchNode) InputPorts ¶
func (n *SwitchNode) InputPorts() []models.InputPort
InputPorts returns the input ports for the node.
func (*SwitchNode) OutputPorts ¶
func (n *SwitchNode) OutputPorts() []models.OutputPort
OutputPorts returns the output ports for the node.
type SwitchNodeFactory ¶
type SwitchNodeFactory struct{}
SwitchNodeFactory creates SwitchNode instances.
func (*SwitchNodeFactory) Create ¶
func (f *SwitchNodeFactory) Create(ctx context.Context, id string, config map[string]any) (protocol.Node, error)
Create creates a new SwitchNode instance.
func (*SwitchNodeFactory) Description ¶
func (f *SwitchNodeFactory) Description() string
Description returns the factory description.
func (*SwitchNodeFactory) Name ¶
func (f *SwitchNodeFactory) Name() string
Name returns the factory name.
func (*SwitchNodeFactory) Schema ¶
func (f *SwitchNodeFactory) Schema() map[string]any
Schema returns the JSON schema for Switch node configuration.