split

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Split node

Type: split
Category: Flow Control

Splits a string, array or object into a sequence of messages.

Behavior

This node is registered as split and runs as part of a workflow. Its exact runtime behavior is implemented in node.go; this document summarizes the editor-facing purpose and configuration contract.

Configuration

Field Type Default Description
addname string Add Name — Optional field name on each output message receiving the part's key (objects) or index
arraySplt integer 1 Array Chunk Length — Number of array elements per emitted message
property string payload Property — Field to split; "payload" (default) or a dotted path inside the payload
splt string \n Split Using — Delimiter for strings (escape sequences like \n allowed) or chunk length when spltType is "len"
spltType string str Split Type

Implementation

  • node.go contains the executor, validation, schema, and registration.
  • editor.html contains the editor integration.
  • node_test.go, when present, contains behavioral tests.

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

type SplitNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

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

Execute passes the input through unchanged — expansion is done by the host via Expand

func (*SplitNode) Expand

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.

Jump to

Keyboard shortcuts

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