Documentation
¶
Index ¶
- Constants
- Variables
- func ClearModeResolver()
- func Dispatch[T any](ctx context.Context, msg T) error
- func DispatchWith[T any](ctx context.Context, msg T, opts command.DispatchOptions) (command.DispatchReceipt, error)
- func DispatchWithResult[T any, R any](ctx context.Context, msg T) (R, error)
- func Query[T any, R any](ctx context.Context, msg T) (R, error)
- func RegisterExecutor(mode command.ExecutionMode, exec CommandExecutor) error
- func Reset()
- func SetModeResolver(resolver ModeResolver)
- func UnregisterExecutor(mode command.ExecutionMode)
- type CommandExecutor
- type ModeResolver
- type Subscription
- func SubscribeCommand[T any](cmd command.Commander[T], runnerOpts ...runner.Option) Subscription
- func SubscribeCommandFunc[T any](handler command.CommandFunc[T], runnerOpts ...runner.Option) Subscription
- func SubscribeQuery[T any, R any](qry command.Querier[T, R], runnerOpts ...runner.Option) Subscription
- func SubscribeQueryFunc[T any, R any](qry command.QueryFunc[T, R], runnerOpts ...runner.Option) Subscription
Constants ¶
View Source
const ( TextCodeDispatchExecutorNotConfigured = "DISPATCH_EXECUTOR_NOT_CONFIGURED" TextCodeDispatchModeResolverFailed = "DISPATCH_MODE_RESOLVER_FAILED" )
Variables ¶
View Source
var ExitOnErr = false
Functions ¶
func ClearModeResolver ¶ added in v0.17.0
func ClearModeResolver()
func DispatchWith ¶ added in v0.17.0
func DispatchWith[T any](ctx context.Context, msg T, opts command.DispatchOptions) (command.DispatchReceipt, error)
func DispatchWithResult ¶ added in v0.3.0
func RegisterExecutor ¶ added in v0.17.0
func RegisterExecutor(mode command.ExecutionMode, exec CommandExecutor) error
func SetModeResolver ¶ added in v0.17.0
func SetModeResolver(resolver ModeResolver)
func UnregisterExecutor ¶ added in v0.17.0
func UnregisterExecutor(mode command.ExecutionMode)
Types ¶
type CommandExecutor ¶ added in v0.17.0
type CommandExecutor interface {
Execute(ctx context.Context, msg any, commandID string, opts command.DispatchOptions) (command.DispatchReceipt, error)
}
type ModeResolver ¶ added in v0.17.0
type Subscription ¶
type Subscription interface {
Unsubscribe()
}
func SubscribeCommand ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.