Documentation
¶
Overview ¶
Package split contains the split node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SplitConfig ¶
type SplitConfig struct {
// Property is the message field to split; "payload" (default) targets
// msg.Payload, otherwise a dotted path inside the data map
Property string `json:"property"`
// Splt is the split delimiter (strings/buffers) or the fixed record
// length when SpltType is "len" (parseInt semantics apply)
Splt string `json:"splt"`
// SpltType selects the split mode: "str" (default) | "bin" | "len"
SpltType string `json:"spltType"`
// ArraySplt is the chunk length for array payloads (default 1)
ArraySplt int `json:"arraySplt"`
// Addname optionally copies each part's key (objects) or index to a
// field on every emitted message
Addname string `json:"addname"`
}
SplitConfig holds configuration for the split node — the Node-RED split equivalent. Splits a string, array, object or buffer into a sequence of messages tagged with `parts` metadata so a downstream join node can reassemble them.
type SplitNode ¶
SplitNode expands one message into a sequence. Execute is a pass-through; the actual fan-out happens in Expand, driven by the host's MessageExpander hook.
func NewSplitNode ¶
func NewSplitNode(node nodestore.NodeInterface, config *SplitConfig) *SplitNode
NewSplitNode creates a new split node
func (*SplitNode) Execute ¶
func (n *SplitNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute passes the input through unchanged — expansion is done by the host via Expand
func (*SplitNode) Expand ¶
func (n *SplitNode) Expand(output nodestore.MessageInterface) []nodestore.MessageInterface
Expand splits the configured property into a sequence of payloads, each carrying `parts` metadata (id, type, index, count, plus ch for strings, key for objects, property when not "payload"). A previous `parts` block is preserved under parts.parts (nested splits). Non-splittable data yields the original message unchanged.