Versions in this module Expand all Collapse all v0 v0.2.0 Mar 21, 2018 v0.1.0 Mar 21, 2018 Changes in this version + const DefaultMinVersionDeadline + const DefaultNamespace + var ErrAggregateNotFound = errors.New("aggregate not found") + var ErrAggregateNotRegistered = errors.New("aggregate not registered") + var ErrCommandNotRegistered = errors.New("command not registered") + var ErrCouldNotSaveEntity = errors.New("could not save entity") + var ErrEntityHasNoVersion = errors.New("entity has no version") + var ErrEntityNotFound = errors.New("could not find entity") + var ErrEventDataNotRegistered = errors.New("event data not registered") + var ErrIncorrectEntityVersion = errors.New("incorrect entity version") + var ErrIncorrectEventVersion = errors.New("mismatching event version") + var ErrInvalidEvent = errors.New("invalid event") + var ErrMissingEntityID = errors.New("missing entity ID") + var ErrNoEventsToAppend = errors.New("no events to append") + func CheckCommand(cmd Command) error + func MarshalContext(ctx context.Context) map[string]interface + func MinVersionFromContext(ctx context.Context) (int, bool) + func NamespaceFromContext(ctx context.Context) string + func NewContextWithMinVersion(ctx context.Context, minVersion int) context.Context + func NewContextWithMinVersionWait(ctx context.Context, minVersion int) (c context.Context, cancel func()) + func NewContextWithNamespace(ctx context.Context, namespace string) context.Context + func RegisterAggregate(factory func(UUID) Aggregate) + func RegisterCommand(factory func() Command) + func RegisterContextMarshaler(f ContextMarshalFunc) + func RegisterContextUnmarshaler(f ContextUnmarshalFunc) + func RegisterEventData(eventType EventType, factory func() EventData) + func UnmarshalContext(vals map[string]interface{}) context.Context + func UnregisterCommand(commandType CommandType) + func UnregisterEventData(eventType EventType) + type Aggregate interface + AggregateType func() AggregateType + func CreateAggregate(aggregateType AggregateType, id UUID) (Aggregate, error) + type AggregateStore interface + Load func(context.Context, AggregateType, UUID) (Aggregate, error) + Save func(context.Context, Aggregate) error + type AggregateType string + type Command interface + AggregateID func() UUID + AggregateType func() AggregateType + CommandType func() CommandType + func CreateCommand(commandType CommandType) (Command, error) + type CommandFieldError struct + Field string + func (c CommandFieldError) Error() string + type CommandHandler interface + HandleCommand func(context.Context, Command) error + func UseCommandHandlerMiddleware(h CommandHandler, middleware ...CommandHandlerMiddleware) CommandHandler + type CommandHandlerFunc func(context.Context, Command) error + func (h CommandHandlerFunc) HandleCommand(ctx context.Context, cmd Command) error + type CommandHandlerMiddleware func(CommandHandler) CommandHandler + type CommandType string + type ContextMarshalFunc func(context.Context, map[string]interface{}) + type ContextUnmarshalFunc func(context.Context, map[string]interface{}) context.Context + type Entity interface + EntityID func() UUID + type Event interface + AggregateID func() UUID + AggregateType func() AggregateType + Data func() EventData + EventType func() EventType + String func() string + Timestamp func() time.Time + Version func() int + func NewEvent(eventType EventType, data EventData, timestamp time.Time) Event + func NewEventForAggregate(eventType EventType, data EventData, timestamp time.Time, ...) Event + type EventBus interface + AddHandler func(EventMatcher, EventHandler) + PublishEvent func(context.Context, Event) error + type EventData interface + func CreateEventData(eventType EventType) (EventData, error) + type EventHandler interface + HandleEvent func(context.Context, Event) error + func UseEventHandlerMiddleware(h EventHandler, middleware ...EventHandlerMiddleware) EventHandler + type EventHandlerFunc func(context.Context, Event) error + func (h EventHandlerFunc) HandleEvent(ctx context.Context, e Event) error + type EventHandlerMiddleware func(EventHandler) EventHandler + type EventMatcher func(Event) bool + func MatchAggregate(t AggregateType) EventMatcher + func MatchAny() EventMatcher + func MatchAnyEventOf(types ...EventType) EventMatcher + func MatchAnyOf(matchers ...EventMatcher) EventMatcher + func MatchEvent(t EventType) EventMatcher + type EventObserver interface + Notify func(context.Context, Event) + type EventPublisher interface + AddObserver func(EventObserver) + type EventStore interface + Load func(context.Context, UUID) ([]Event, error) + Save func(ctx context.Context, events []Event, originalVersion int) error + type EventStoreError struct + BaseErr error + Err error + Namespace string + func (e EventStoreError) Error() string + type EventStoreMaintainer interface + RenameEvent func(ctx context.Context, from, to EventType) error + Replace func(context.Context, Event) error + type EventType string + type Iter interface + Close func() error + Next func() bool + Value func() interface{} + type ReadRepo interface + Find func(context.Context, UUID) (Entity, error) + FindAll func(context.Context) ([]Entity, error) + Parent func() ReadRepo + type ReadWriteRepo interface + type RepoError struct + BaseErr error + Err error + Namespace string + func (e RepoError) Error() string + type UUID string + func NewUUID() UUID + func ParseUUID(s string) (UUID, error) + func (id *UUID) UnmarshalJSON(data []byte) error + func (id UUID) MarshalJSON() ([]byte, error) + func (id UUID) String() string + type Versionable interface + AggregateVersion func() int + type WriteRepo interface + Remove func(context.Context, UUID) error + Save func(context.Context, Entity) error