Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandHandler ¶
func ChainCommandHandler ¶
func ChainCommandHandler[C any](handler CommandHandler[C], middlewares ...CommandHandlerMiddleware[C]) CommandHandler[C]
ChainCommandHandler decorates the given CommandHandler with all middlewares.
type CommandHandlerFunc ¶
The CommandHandlerFunc type is an adapter to allow the use of ordinary functions as CommandHandler. If f is a function with the appropriate signature, CommandHandlerFunc(f) is a CommandHandler that calls f.
type CommandHandlerMiddleware ¶
type CommandHandlerMiddleware[C any] interface { // Decorate wraps the underlying Command, adding some functionality. Decorate(handler CommandHandler[C]) CommandHandler[C] }
CommandHandlerMiddleware allows us to write something like decorators to CommandHandler. It can execute something before Handle or after.
type CommandHandlerMiddlewareFunc ¶
type CommandHandlerMiddlewareFunc[C any] func(handler CommandHandler[C]) CommandHandler[C]
The CommandHandlerMiddlewareFunc type is an adapter to allow the use of ordinary functions as CommandHandlerMiddleware. If f is a function with the appropriate signature, CommandHandlerMiddlewareFunc(f) is a CommandHandlerMiddleware that calls f.
func (CommandHandlerMiddlewareFunc[C]) Decorate ¶
func (f CommandHandlerMiddlewareFunc[C]) Decorate(handler CommandHandler[C]) CommandHandler[C]
Decorate call f(cmd).
type QueryHandler ¶
func ChainQueryHandler ¶
func ChainQueryHandler[Q any, R any](handler QueryHandler[Q, R], middlewares ...QueryHandlerMiddleware[Q, R]) QueryHandler[Q, R]
ChainQueryHandler decorates the given QueryHandler with all middlewares.
type QueryHandlerFunc ¶
The QueryHandlerFunc type is an adapter to allow the use of ordinary functions as QueryHandler. If f is a function with the appropriate signature, QueryHandlerFunc(f) is a QueryHandler that calls f.
type QueryHandlerMiddleware ¶
type QueryHandlerMiddleware[Q any, R any] interface { // Decorate wraps the underlying Command, adding some functionality. Decorate(QueryHandler[Q, R]) QueryHandler[Q, R] }
QueryHandlerMiddleware allows us to write something like decorators to QueryHandler. It can execute something before Handle or after.
type QueryHandlerMiddlewareFunc ¶
type QueryHandlerMiddlewareFunc[Q any, R any] func(QueryHandler[Q, R]) QueryHandler[Q, R]
The QueryHandlerMiddlewareFunc type is an adapter to allow the use of ordinary functions as QueryHandlerMiddleware. If f is a function with the appropriate signature, QueryHandlerMiddlewareFunc(f) is a QueryHandlerMiddleware that calls f.
func (QueryHandlerMiddlewareFunc[Q, R]) Decorate ¶
func (f QueryHandlerMiddlewareFunc[Q, R]) Decorate(handler QueryHandler[Q, R]) QueryHandler[Q, R]
Decorate call f(cmd).