Help us shape the future of Go! Take the 2026 Go Developer Survey

switchnode

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: BSD-2-Clause Imports: 6 Imported by: 0

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

View Source
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

type SwitchCase struct {
	Value      string `json:"value"`
	OutputPort string `json:"output_port"`
}

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

Execute evaluates the value and routes to the matching output port.

func (*SwitchNode) ID

func (n *SwitchNode) ID() string

ID returns the node ID.

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.

func (*SwitchNode) Type

func (n *SwitchNode) Type() string

Type returns the node type.

func (*SwitchNode) Validate

func (n *SwitchNode) Validate(config map[string]any) error

Validate validates the node configuration.

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) ID

func (f *SwitchNodeFactory) ID() string

ID returns the factory ID.

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.

Jump to

Keyboard shortcuts

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