Versions in this module Expand all Collapse all v0 v0.1.0 Apr 13, 2026 Changes in this version + var ErrDuplicateHandler = errors.New("dispatch: duplicate handler") + var ErrUnknownHandler = errors.New("dispatch: unknown handler") + type Dispatched struct + Duration time.Duration + Error error + Handler string + MatchedExpr string + Panicked bool + type Dispatcher struct + func New[E any, A any](opts ...DispatcherOpt[E, A]) (*Dispatcher[E, A], error) + func (d *Dispatcher[E, A]) Describe() []HandlerInfo + func (d *Dispatcher[E, A]) Plan(opts ...PlanOpt[E, A]) (*Plan[E, A], error) + type DispatcherOpt func(*dispatcherConfig[E, A]) error + func Handle[E any, A any](name string, fn HandlerFunc[E, A], opts ...HandleOpt) DispatcherOpt[E, A] + func WithLogger[E any, A any](l *slog.Logger) DispatcherOpt[E, A] + type HandleOpt func(*handleConfig) + func WithDescription(desc string) HandleOpt + type HandlerFunc func(ctx context.Context, eval *rules.Evaluation[E, A]) error + type HandlerInfo struct + Description string + Name string + type Plan struct + func (p *Plan[E, A]) Describe() []PlanInfo + func (p *Plan[E, A]) Execute(ctx context.Context, eval *rules.Evaluation[E, A]) *Result[E, A] + func (p *Plan[E, A]) Name() string + type PlanInfo struct + Handler string + Whens []string + type PlanOpt func(*planConfig[E, A]) error + func Gate[E any, A any](expr string) PlanOpt[E, A] + func Run[E any, A any](name string, opts ...RunOpt[E, A]) PlanOpt[E, A] + func WithName[E any, A any](name string) PlanOpt[E, A] + func WithStrategy[E any, A any](s Strategy) PlanOpt[E, A] + type Result struct + Dispatched []Dispatched + Duration time.Duration + Evaluation *rules.Evaluation[E, A] + GateExpr string + GatePassed bool + Gated bool + Plan string + func (r *Result[E, A]) Debug() string + func (r *Result[E, A]) Errors() []error + func (r *Result[E, A]) OK() bool + type RunOpt func(*runConfig[E, A]) + func When[E any, A any](expr string) RunOpt[E, A] + type Strategy int + const AllContinue + const AllHaltOnError + const FirstMatch + func (s Strategy) String() string