MCPcopy Create free account
hub / github.com/The-Pocket/PocketFlow-Go / BatchNode

Struct BatchNode

pocketflow.go:343–358  ·  view source on GitHub ↗

--- Batch Node (Processes items individually) --- BatchNode implements BaseNode to process slices of items.

Source from the content-addressed store, hash-verified

341
342// BatchNode implements BaseNode to process slices of items.
343type BatchNode struct {
344 nodeCore
345 MaxRetries int
346 WaitMilliseconds time.Duration
347
348 // User-defined functions
349 // Prep returns a slice (or error)
350 PrepFunc func(ctx *PfContext, params map[string]any) ([]any, error)
351 // ExecItem operates on a single item from the Prep slice
352 ExecItemFunc func(ctx *PfContext, params map[string]any, item any) (any, error)
353 // Post receives the original prep slice and the slice of exec results
354 PostFunc func(ctx *PfContext, params map[string]any, prepResult []any, execResult []any) (string, error)
355
356 // Optional fallback for individual item processing
357 ExecItemFallbackFunc func(ctx *PfContext, params map[string]any, item any, lastErr error) (any, error)
358}
359
360// NewBatchNode creates a new BatchNode with default settings.
361func NewBatchNode() *BatchNode {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected