Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrHandlerNotFound = errors.New("message handler not found")
)
Errors
Functions ¶
This section is empty.
Types ¶
type Mediator ¶
type Mediator interface {
// Send delegates a message to the appropriate handler
Send(ctx context.Context, msg interface{}) (res interface{}, err error)
}
Mediator is a simple implementation of the mediator pattern
type Option ¶
type Option func(*mediator) error
Option is a function that modifies the mediator with certain options
func WithHandler ¶
func WithHandler(h interface{}) Option
WithHandler adds a message handler to the mediator a handler must have an Handle method with two arguments and two return values
func WithHandlerFunc ¶
func WithHandlerFunc(f interface{}) Option
WithHandlerFunc adds a handler func which takes two arguments, a context and a message.
Click to show internal directories.
Click to hide internal directories.