Documentation
¶
Overview ¶
Package workflow provides the base workflow implementation.
BaseWorkflow wraps an orchestration function and implements the Workflow[In, Out] interface from core. It serves as the innermost layer in a decorator chain — decorators (logging, metrics) wrap BaseWorkflow to add cross-cutting concerns without modifying the orchestration logic.
Unlike pipelines (pure stateless transformations), workflows coordinate stateful operations across services, pipelines, repositories, and caches.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTxWorkflow ¶ added in v0.3.2
func NewTxWorkflow[In, Out any]( txMgr interfaces.TransactionManager, pipe interfaces.Pipeline[In, Out], ) interfaces.Workflow[In, Out]
NewTxWorkflow returns a workflow that runs pipe inside one transaction opened by txMgr: the pipeline sees the transaction's context, so every repository call it makes joins the transaction, which commits when the pipeline succeeds and rolls back when it fails. The pipeline's error, or the commit's, is returned unchanged (its code intact) with a zero output — a result whose transaction did not commit never reaches the caller.
Types ¶
type BaseWorkflow ¶
BaseWorkflow wraps an orchestration function and implements the Workflow[In, Out] interface. It provides a functional escape hatch for simple workflows, though workflows are typically stateful (holding service/pipeline/cache references).
func NewBaseWorkflow ¶
func NewBaseWorkflow[In, Out any]( fn func(context.Context, In) (Out, error), ) *BaseWorkflow[In, Out]
NewBaseWorkflow creates a new BaseWorkflow wrapping the given function. Panics if fn is nil.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package decorators provides fluent decorator composition for workflows.
|
Package decorators provides fluent decorator composition for workflows. |