Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrHandlerMissingAction = errors.New("no action function specified for handler") ErrParallelHandlerNotSupported = errors.New("parallel handler is supported only in EffectFlow") )
Functions ¶
func ExecuteEffectFlow ¶
func ExecuteEffectFlow(f *EffectFlow[any]) error
func ExecutePureFlow ¶
Types ¶
type EffectFlow ¶
type EffectFlow[T any] struct { // contains filtered or unexported fields }
func NewEffectFlow ¶
func NewEffectFlow(flowOpts *Opts, terminalOnError func(err error), handlers ...*Handler[any]) (*EffectFlow[any], error)
NewEffectFlow creates effect flow. If terminalOnError is specified this function will be used as global error callback and no handler onError functions will be called. to override this behavior look at Opts.ExecuteOnErrorAlways
type Handler ¶
type Handler[T any] struct { // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler[T any](action HandlerAction[T], onError HandlerErrorAction[T]) *Handler[T]
func NewParallelHandlerGroup ¶
func NewParallelHandlerGroup[T any](onError HandlerErrorAction[T], handlers ...*Handler[T]) *Handler[T]
NewParallelHandlerGroup creates handler wrapping multiple handlers marked for parallel execution. if any error occurs in parallel handler, onError of all handlers in ParallelGroup are called, if error occurs in handler ordinary handler that was called after ParallelGroup, only ParallelGroup onError will be executed
type HandlerAction ¶
type HandlerErrorAction ¶
type PureFlow ¶
type PureFlow[T any] struct { // contains filtered or unexported fields }
func NewPureFlow ¶
func NewPureFlow[T any](flowOpts *Opts, terminalOnError func(err error), initialData T, handlers ...*Handler[T]) (*PureFlow[T], error)
NewPureFlow creates effect flow. If terminalOnError is specified this function will be used as global error callback and no handler onError functions will be called. to override this behavior look at Opts.ExecuteOnErrorAlways