Versions in this module Expand all Collapse all v0 v0.9.0 Jul 23, 2026 v0.8.0 Jul 21, 2026 Changes in this version + const CommandDispatched + const CommandRequested + const CompensationCompleted + const CompensationFailed + const CompensationStarted + const Completed + const Failed + const Started + const TimeoutCanceled + const TimeoutFired + const TimeoutRequested + const TriggerRecorded + var ErrEffectConflict = errors.New("conflicting effect") + var ErrEmptyEffectKey = errors.New("empty effect key") + var ErrInvalidTransition = errors.New("invalid workflow transition") + var ErrNotCompensating = errors.New("workflow is not compensating") + func ByAggregateID[Data any](evt event.Of[Data]) (uuid.UUID, bool) + func RegisterEvents(r codec.Registerer) + type Base struct + func New(name string, id uuid.UUID) *Base + func (b *Base) Done() bool + func (b *Base) MarshalSnapshot() ([]byte, error) + func (b *Base) Reason() string + func (b *Base) Status() Status + func (b *Base) UnmarshalSnapshot(p []byte) error + type CommandDispatchedData struct + EffectID uuid.UUID + type CommandRequestedData struct + AggregateID uuid.UUID + AggregateName string + CommandID uuid.UUID + EffectID uuid.UUID + Key string + Name string + Payload []byte + TriggerID uuid.UUID + type CompensationCompletedData struct + type CompensationFailedData struct + Reason string + type CompensationStartedData struct + Reason string + type CompletedData struct + type Config struct + CommandBus command.Bus + Commands codec.Encoding + DispatchInterval time.Duration + EventBus event.Bus + EventStore event.Store + NewRepository func(event.Store) aggregate.Repository + RecoveryWindow time.Duration + ResyncInterval time.Duration + Strict bool + TimerResolution time.Duration + TriggerReplayWindow time.Duration + Workers int + type Correlator func(event.Of[Data]) (uuid.UUID, bool) + func ByKey[Data any](namespace uuid.UUID, key func(Data) string) Correlator[Data] + type Ctx interface + Compensate func(reason error) error + Compensated func() error + CompensationFailed func(reason error) error + Complete func() error + Dispatch func(key string, cmd command.Command) error + Event func() event.Of[Data] + Fail func(reason error) error + Schedule func(key string, at time.Time) error + Unschedule func(key string) error + type Definition struct + func Define[W Workflow](create func(uuid.UUID) W, opts ...Option[W]) Definition + type FailedData struct + Reason string + type Option struct + func Compensates[W Workflow, Data any](correlate Correlator[Data], handler func(W, Ctx[Data]) error, ...) Option[W] + func OnCompensationTimeout[W Workflow](key string, handler func(W, Ctx[TimeoutFiredData]) error) Option[W] + func OnTimeout[W Workflow](key string, handler func(W, Ctx[TimeoutFiredData]) error) Option[W] + func Reacts[W Workflow, Data any](correlate Correlator[Data], handler func(W, Ctx[Data]) error, ...) Option[W] + func Starts[W Workflow, Data any](correlate Correlator[Data], handler func(W, Ctx[Data]) error, ...) Option[W] + func WithRepository[W Workflow](repo aggregate.TypedRepository[W]) Option[W] + type Service struct + func NewService(cfg Config, defs ...Definition) *Service + func (s *Service) Run(ctx context.Context) (<-chan error, error) + func (s *Service) Trigger(ctx context.Context, evt event.Event) error + type StartedData struct + type Status string + const StatusCompensated + const StatusCompensating + const StatusCompleted + const StatusFailed + const StatusRunning + type TimeoutCanceledData struct + EffectID uuid.UUID + Key string + type TimeoutFiredData struct + EffectID uuid.UUID + Key string + ScheduledFor time.Time + WorkflowID uuid.UUID + type TimeoutRequestedData struct + At time.Time + EffectID uuid.UUID + Key string + TriggerID uuid.UUID + type TriggerRecordedData struct + TriggerID uuid.UUID + TriggerName string + type Workflow interface