dispatcher

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 7 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExitOnErr = false

Functions

func Dispatch

func Dispatch[T any](ctx context.Context, msg T) error

Dispatch executes all registered CommandHandlers for T.

func DispatchWithResult added in v0.3.0

func DispatchWithResult[T any, R any](ctx context.Context, msg T) (R, error)

func Query

func Query[T any, R any](ctx context.Context, msg T) (R, error)

Query executes the single registered QueryHandler for T, returning R.

func Reset added in v0.13.0

func Reset()

Reset clears all command/query subscriptions.

Types

type Subscription

type Subscription interface {
	Unsubscribe()
}

func SubscribeCommand

func SubscribeCommand[T any](cmd command.Commander[T], runnerOpts ...runner.Option) Subscription

Subscribe a CommandHandler for a particular message type T. TODO: should this return an error?!

func SubscribeCommandFunc

func SubscribeCommandFunc[T any](handler command.CommandFunc[T], runnerOpts ...runner.Option) Subscription

func SubscribeQuery

func SubscribeQuery[T any, R any](qry command.Querier[T, R], runnerOpts ...runner.Option) Subscription

Subscribe a QueryHandler for a particular message type T, R.

func SubscribeQueryFunc

func SubscribeQueryFunc[T any, R any](qry command.QueryFunc[T, R], runnerOpts ...runner.Option) Subscription

Jump to

Keyboard shortcuts

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