workflow

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package workflow is the workflow tier: a Base builds a consumer's request workflows, the one boundary observed in every environment and the owner of the transaction boundary. Every workflow is a core interfaces.Workflow, decorated in the tier's order (Tier), so a consumer declares no workflow interface of its own.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tier added in v0.0.7

func Tier() decorate.Tier

Tier is the workflow tier's decoration: recovery → logging → tracing → metrics → timeout, outermost first.

Types

type Base added in v0.0.7

type Base struct {
	// contains filtered or unexported fields
}

Base builds a consumer's request workflows over the workflow tier's collaborators.

func NewBase added in v0.0.7

NewBase builds the Base over tx (needed only by Tx) whose workflows are decorated with deps.

func (Base) Func added in v0.0.7

func (b Base) Func[In, Out any](
	op string,
	fn func(context.Context, In) (Out, error),
) interfaces.Workflow[In, Out]

Func wraps fn as the decorated workflow named op; it runs as op's "Execute" operation. A nil fn panics, as a wiring bug.

func (Base) Read added in v0.0.7

func (b Base) Read[In, Out any](
	op string,
	pipe interfaces.Pipeline[In, Out],
) interfaces.Workflow[In, Out]

Read runs pipe as the decorated workflow op, with no transaction.

func (Base) Tx added in v0.0.7

func (b Base) Tx[In, Out any](
	op string,
	pipe interfaces.Pipeline[In, Out],
) interfaces.Workflow[In, Out]

Tx runs pipe in one transaction as the decorated workflow op: 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 with its code intact and a zero output, so a result whose transaction did not commit never reaches the caller.

func (Base) Wrap added in v0.0.7

func (b Base) Wrap[In, Out any](
	op string,
	wf interfaces.Workflow[In, Out],
) interfaces.Workflow[In, Out]

Wrap decorates a custom workflow (a saga, a multi-transaction flow) as op.

Jump to

Keyboard shortcuts

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