{"modulePath":"github.com/dracory/nodebase","version":"v0.7.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package batch\n\nPackage batch contains the batch node implementation.\n\n## Types\n\n```go\ntype BatchConfig struct {\n\t// Mode selects grouping: \"count\" batches every N messages,\n\t// \"interval\" flushes everything buffered every Interval seconds,\n\t// \"concat\" merges one complete parts sequence per configured topic\n\tMode string `json:\"mode\"`\n\t// Count is the batch size for \"count\" mode\n\tCount int `json:\"count\"`\n\t// Overlap keeps the last N messages of a batch for the next batch\n\t// (\"count\" mode)\n\tOverlap int `json:\"overlap\"`\n\t// Interval is the window length in seconds for \"interval\" mode\n\tInterval float64 `json:\"interval\"`\n\t// AllowEmptySequence emits an empty sequence message when an\n\t// interval window closes with nothing buffered\n\tAllowEmptySequence bool `json:\"allowEmptySequence\"`\n\t// HonourParts flushes a count-mode batch early when an incoming\n\t// parts sequence completes (parts.index+1 == parts.count)\n\tHonourParts bool `json:\"honourParts\"`\n\t// Topics lists the concat-mode topics in output order; each entry\n\t// is {\"topic\": \"...\"} as serialized by Node-RED\n\tTopics []struct {\n\t\tTopic string `json:\"topic\"`\n\t} `json:\"topics\"`\n}\n```\nBatchConfig holds configuration for the batch node — the Node-RED batch equivalent. Buffers messages and re-emits them as a parts sequence (count/interval) or concatenates topic sequences (concat).\n\n```go\ntype BatchNode struct {\n\t*nodebase.BaseNode\n\t// contains filtered or unexported fields\n}\n```\nBatchNode re-emits buffered messages as a parts sequence. Buffered messages are dropped (nil return); completed batches go downstream asynchronously through the node's outgoing edges.\n\n```go\nfunc NewBatchNode(node nodestore.NodeInterface, config *BatchConfig, host nodebase.NodeHost) *BatchNode\n```\nNewBatchNode creates a new batch node\n\n```go\nfunc (n *BatchNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)\n```\nExecute buffers the message and, when a batch completes, emits the sequence asynchronously — the triggering message itself is dropped.\n\n```go\nfunc (n *BatchNode) Validate() error\n```\nValidate rejects unsupported modes at deploy time\n\n","path":"github.com/dracory/nodebase/batch","name":"batch","synopsis":"Package batch contains the batch node implementation.","isRedistributable":true}
