Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/The-Pocket/PocketFlow-Go
/ functions
Functions
78 in github.com/The-Pocket/PocketFlow-Go
⨍
Functions
78
◇
Types & classes
8
↓ 19 callers
Function
newPocketFlowError
(msg string, cause error)
pocketflow.go:62
↓ 10 callers
Method
initCore
()
pocketflow.go:117
↓ 8 callers
Method
Next
Next connects this node to another node for a specific action. Returns the *next* node for chaining.
pocketflow.go:93
↓ 8 callers
Method
Value
(key any)
pocketflow.go:15
↓ 7 callers
Method
SetExec
SetExec sets the ExecFunc.
pocketflow.go:235
↓ 6 callers
Function
logWarn
(format string, v ...any)
pocketflow.go:66
↓ 5 callers
Method
SetParams
SetParams sets node-specific parameters. Returns the node for chaining.
pocketflow.go:87
↓ 5 callers
Method
SetValue
(key any, value any)
pocketflow.go:25
↓ 4 callers
Method
GetParams
GetParams returns the node's current parameters.
pocketflow.go:90
↓ 4 callers
Method
Run
Run executes a single node's lifecycle (prep, exec, post). Useful for standalone execution. Returns the resulting action and error.
pocketflow.go:103
↓ 4 callers
Method
SetPost
SetPost sets the PostFunc.
pocketflow.go:241
↓ 4 callers
Method
SetRetry
SetRetry configures retry behaviour.
pocketflow.go:216
↓ 3 callers
Method
SetPrep
SetPrep sets the PrepFunc.
pocketflow.go:229
↓ 3 callers
Function
resultCaptureNode
resultCaptureNode creates a node that captures the context value into its own params.
pocketflow_test.go:65
↓ 2 callers
Method
Run
Run starts the flow execution.
pocketflow.go:621
↓ 2 callers
Function
addNumberNode
addNumberNode creates a node that adds a number based on context.
pocketflow_test.go:41
↓ 2 callers
Method
orchestrate
orchestrate executes the node chain starting from startNode. initialParams are merged with the flow's own params for the *first* node. Returns the las
pocketflow.go:654
↓ 2 callers
Function
setNumberNode
--- Test Node Implementations using Functional Style --- setNumberNode creates a node that sets a number in the context.
pocketflow_test.go:20
↓ 1 callers
Method
Error
()
pocketflow.go:49
↓ 1 callers
Method
Exec
(ctx *PfContext, prepResult any)
pocketflow.go:270
↓ 1 callers
Method
Exec
Exec iterates through the prepResult slice, calling ExecItemFunc for each item with retries.
pocketflow.go:433
↓ 1 callers
Method
Exec
Exec for the Flow initiates the orchestration. Should not be called directly by user.
pocketflow.go:595
↓ 1 callers
Method
GetNextNode
GetNextNode retrieves the successor node for a given action (or DefaultAction).
pocketflow.go:99
↓ 1 callers
Method
InternalRun
InternalRun is used by Flow orchestration to execute the node lifecycle. Separated from Run to prevent potential issues if Run is overridden incorrect
pocketflow.go:107
↓ 1 callers
Method
InternalRun
(ctx *PfContext)
pocketflow.go:296
↓ 1 callers
Method
InternalRun
InternalRun implements the retry logic at the item level within Exec.
pocketflow.go:526
↓ 1 callers
Method
InternalRun
InternalRun executes the flow's lifecycle: Prep, Orchestrate (via Exec), Post.
pocketflow.go:627
↓ 1 callers
Method
InternalRun
InternalRun executes the BatchFlow lifecycle: PrepBatch, Exec(orchestrate per batch), PostBatch.
pocketflow.go:822
↓ 1 callers
Method
Post
(ctx *PfContext, prepResult any, execResult any)
pocketflow.go:278
↓ 1 callers
Method
Post
Post calls the user-defined PostFunc.
pocketflow.go:489
↓ 1 callers
Method
Post
Post for the Flow runs after orchestration completes. Default returns the final action.
pocketflow.go:611
↓ 1 callers
Method
Post
Post for BatchFlow runs its PostBatchFunc.
pocketflow.go:792
↓ 1 callers
Method
Prep
(ctx *PfContext)
pocketflow.go:263
↓ 1 callers
Method
Prep
Prep calls the user-defined PrepFunc.
pocketflow.go:424
↓ 1 callers
Method
Prep
Prep for the Flow itself. Default is no-op. Can be overridden if needed.
pocketflow.go:589
↓ 1 callers
Method
Prep
--- BaseNode Implementation Overrides for BatchFlow --- Prep for BatchFlow runs its PrepBatchFunc.
pocketflow.go:753
↓ 1 callers
Method
Run
Run starts the BatchFlow execution.
pocketflow.go:816
↓ 1 callers
Method
SetExecItem
SetExecItem sets the ExecItemFunc for processing individual items.
pocketflow.go:395
↓ 1 callers
Method
SetFallback
SetFallback sets the ExecFallbackFunc.
pocketflow.go:247
↓ 1 callers
Method
SetItemFallback
SetItemFallback sets the ExecItemFallbackFunc.
pocketflow.go:407
↓ 1 callers
Method
SetParams
--- BaseNode Implementation for Flow --- Most BaseNode methods are less relevant for Flow itself, focused on orchestration.
pocketflow.go:577
↓ 1 callers
Method
SetPostBatch
SetPostBatch sets the function to run after all batches complete.
pocketflow.go:745
↓ 1 callers
Method
SetPrepBatch
SetPrepBatch sets the function to generate batch parameters.
pocketflow.go:739
↓ 1 callers
Function
simpleLogNode
simpleLogNode creates a node for BatchFlow testing.
pocketflow_test.go:91
Method
Exec
Exec performs the main work using the result from Prep. Returns the execution result (can be nil) and an error.
pocketflow.go:80
Method
Exec
Exec for BatchFlow runs the orchestration for each batch item. The 'prepResult' here is the []*pfContext from BatchFlow.Prep.
pocketflow.go:763
Method
GetNextNode
(action string)
pocketflow.go:166
Method
GetParams
()
pocketflow.go:140
Method
GetSuccessors
GetSuccessors returns the map of action->node successors.
pocketflow.go:96
Method
GetSuccessors
()
pocketflow.go:161
Function
NewBatchFlow
NewBatchFlow creates a new BatchFlow.
pocketflow.go:722
Function
NewBatchNode
NewBatchNode creates a new BatchNode with default settings.
pocketflow.go:361
Function
NewFlow
NewFlow creates a new Flow, optionally with a starting node.
pocketflow.go:557
Function
NewNode
NewNode creates a new Node with default retry settings (1 try, 0 wait).
pocketflow.go:200
Method
Next
(action string, node BaseNode)
pocketflow.go:146
Method
Next
(action string, node BaseNode)
pocketflow.go:259
Method
Next
(action string, node BaseNode)
pocketflow.go:419
Method
Next
Next for a Flow doesn't make logical sense in the standard execution model.
pocketflow.go:583
Method
Post
Post processes results, updates context, and returns the next action string. An empty string implies DefaultAction. Returns an error if post-processin
pocketflow.go:84
Method
Prep
Prep prepares input for Exec using the shared context. Returns the prepared data (can be nil) and an error.
pocketflow.go:76
Method
Run
(ctx *PfContext)
pocketflow.go:289
Method
Run
(ctx *PfContext)
pocketflow.go:518
Method
SetParams
(params map[string]any)
pocketflow.go:126
Method
SetParams
--- BaseNode Implementation for Node ---
pocketflow.go:254
Method
SetParams
--- BaseNode Implementation for BatchNode ---
pocketflow.go:414
Method
SetPost
SetPost sets the PostFunc. Receives []any prep and []any exec results.
pocketflow.go:401
Method
SetPrep
SetPrep sets the PrepFunc. Expects a function returning []any.
pocketflow.go:389
Method
SetRetry
SetRetry configures retry behaviour.
pocketflow.go:376
Method
Start
Start sets the initial node for the flow. Returns the start node for chaining setup.
pocketflow.go:566
Function
TestBatchFlowExecution
(t *testing.T)
pocketflow_test.go:174
Function
TestBatchNodeItemRetryAndFallback
(t *testing.T)
pocketflow_test.go:265
Function
TestBranchingFlow
(t *testing.T)
pocketflow_test.go:134
Function
TestNodeRetryFailureWithFallback
(t *testing.T)
pocketflow_test.go:224
Function
TestNodeRetryFailureWithoutFallback
(t *testing.T)
pocketflow_test.go:247
Function
TestNodeRetrySuccess
--- Additional Tests ---
pocketflow_test.go:206
Function
TestSimpleLinearFlow
--- Test Methods ---
pocketflow_test.go:110
Method
Unwrap
Unwrap allows PocketFlowError to work with errors.Is and errors.As.
pocketflow.go:58
Function
WithParam
(parent context.Context, param map[any]any)
pocketflow.go:32