Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAggregate = errors.New("invalid aggregate")
ErrInvalidAggregate occurs when a loaded aggregate is not an aggregate.
var ErrInvalidRepo = errors.New("invalid repo")
ErrInvalidRepo is when a dispatcher is created with a nil repo.
Functions ¶
This section is empty.
Types ¶
type AggregateStore ¶
type AggregateStore struct {
// contains filtered or unexported fields
}
AggregateStore is an aggregate store that uses a read write repo for loading and saving aggregates.
func NewAggregateStore ¶
func NewAggregateStore(repo eh.ReadWriteRepo, bus eh.EventBus) (*AggregateStore, error)
NewAggregateStore creates an aggregate store with a read write repo.
type EventPublisher ¶
type EventPublisher interface { // EventsToPublish returns all events to publish. EventsToPublish() []eh.Event }
EventPublisher is an optional event publisher that can be implemented by aggregates to allow for publishing of events on a successful save.
type SliceEventPublisher ¶
SliceEventPublisher is an EventPublisher using a slice to store events.
func (*SliceEventPublisher) EventsToPublish ¶
func (a *SliceEventPublisher) EventsToPublish() []eh.Event
EventsToPublish implements the EventsToPublish method of the EventPublisher interface.
func (*SliceEventPublisher) PublishEvent ¶
func (a *SliceEventPublisher) PublishEvent(e eh.Event)
PublishEvent registers an event to be published after the aggregate has been successfully saved.