Documentation ¶
Index ¶
- func Dispatch(ev Event)
- func SetDefault(m Mediator)
- func Subscribe(hdl EventHandler)
- type Event
- type EventCollection
- type EventHandler
- type EventKind
- type InMemMediator
- func (m *InMemMediator) Dispatch(ev Event)
- func (m *InMemMediator) Subscribe(hdl EventHandler)
- func (m *InMemMediator) WithGenContext(fn func(ctx context.Context, ev Event) context.Context)
- func (m *InMemMediator) WithOrphanEventHandler(fn func(Event))
- func (m *InMemMediator) WithTimeout(timeout time.Duration)
- type Mediator
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(m Mediator)
func Subscribe ¶
func Subscribe(hdl EventHandler)
Types ¶
type EventCollection ¶
func NewEventCollection ¶
func NewEventCollection() EventCollection
type EventHandler ¶
type InMemMediator ¶
type InMemMediator struct {
// contains filtered or unexported fields
}
InMemMediator is a simple in-memory mediator implementation.
func (*InMemMediator) Dispatch ¶
func (m *InMemMediator) Dispatch(ev Event)
Dispatch dispatches an event to the mediator.
func (*InMemMediator) Subscribe ¶
func (m *InMemMediator) Subscribe(hdl EventHandler)
Subscribe registers an event handler to the mediator.
func (*InMemMediator) WithGenContext ¶ added in v0.5.11
WithGenContext present a function to generate a new context for each handler.
func (*InMemMediator) WithOrphanEventHandler ¶
func (m *InMemMediator) WithOrphanEventHandler(fn func(Event))
WithOrphanEventHandler present a function to handle the event when no handler is found.
func (*InMemMediator) WithTimeout ¶ added in v0.5.11
func (m *InMemMediator) WithTimeout(timeout time.Duration)
WithTimeout present a timeout for each handler.
type Mediator ¶
type Mediator interface { Dispatch(Event) Subscribe(EventHandler) }
Mediator is the interface that wraps the methods of a mediator.
func NewInMemMediator ¶
Click to show internal directories.
Click to hide internal directories.