Documentation ¶
Index ¶
- Variables
- func CommandHandlerNotImplemented(commandType eventhorizon.CommandType) error
- func ConvertToCommandTypes(commands []enum.Literal) []eventhorizon.CommandType
- func ConvertToEventTypes(events []enum.Literal) []eventhorizon.EventType
- func EntityAlreadyExists(entityId uuid.UUID, aggregateType eventhorizon.AggregateType) error
- func EntityChildIdNotDefined(entityId uuid.UUID, aggregateType eventhorizon.AggregateType, childType string) error
- func EntityChildNotExists(entityId uuid.UUID, aggregateType eventhorizon.AggregateType, ...) error
- func EntityNotExists(entityId uuid.UUID, aggregateType eventhorizon.AggregateType) error
- func EventHandlerNotImplemented(eventType eventhorizon.EventType) error
- func IdNotDefined(currentId uuid.UUID, aggregateType eventhorizon.AggregateType) error
- func IdsDismatch(entityId uuid.UUID, currentId uuid.UUID, ...) error
- func NewErrCouldNotLoadAggregate(_ context.Context, err error) error
- func NewErrCouldNotMarshalEvent(_ context.Context, err error) error
- func NewErrCouldNotSaveAggregate(_ context.Context, err error) error
- func NewErrCouldNotUnmarshalEvent(_ context.Context, err error) error
- func NewErrIncorrectEventVersion(_ context.Context) error
- func QueryNotImplemented(queryName string) error
- func ValidateIdsMatch(entityId uuid.UUID, currentId uuid.UUID, ...) (ret error)
- func ValidateNewId(entityId uuid.UUID, currentId uuid.UUID, ...) (ret error)
- type AggregateEngine
- func (o *AggregateEngine) RegisterForEvent(handler eventhorizon.EventHandler, event enum.Literal) (err error)
- func (o *AggregateEngine) RegisterForEvents(handler eventhorizon.EventHandler, events []eventhorizon.EventType) (err error)
- func (o *AggregateEngine) RegisterForEventsAll(handler eventhorizon.EventHandler) (err error)
- func (o *AggregateEngine) RegisterProjector(projectorType string, listener DelegateEventHandler) (ret *ProjectorEventHandler, err error)
- func (o *AggregateEngine) RegisterSagaForEvents(aSaga saga.Saga, events []eventhorizon.EventType) (err error)
- func (o *AggregateEngine) Setup() (err error)
- type AggregateStoreEvent
- type CommandError
- type DelegateCommandHandler
- type DelegateEventHandler
- type Entity
- type EventStoreDelegate
- func (o *EventStoreDelegate) Close() (err error)
- func (o *EventStoreDelegate) Load(ctx context.Context, id uuid.UUID) (ret []eventhorizon.Event, err error)
- func (o *EventStoreDelegate) LoadFrom(ctx context.Context, id uuid.UUID, version int) (ret []eventhorizon.Event, err error)
- func (o *EventStoreDelegate) Save(ctx context.Context, events []eventhorizon.Event, originalVersion int) (err error)
- type HttpCommandHandler
- type HttpQueryHandler
- type Middleware
- type ProjectorEventHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAggregateDeleted = errors.New("the aggregate has already been deleted")
View Source
var ErrCouldNotClearDB = errors.New("could not clear database")
View Source
var ErrCouldNotLoadAggregate = errors.New("could not load aggregate")
View Source
var ErrCouldNotMarshalEvent = errors.New("could not marshal dbEvent")
View Source
var ErrCouldNotSaveAggregate = errors.New("could not save aggregate")
View Source
var ErrCouldNotUnmarshalEvent = errors.New("could not unmarshal dbEvent")
Functions ¶
func CommandHandlerNotImplemented ¶
func CommandHandlerNotImplemented(commandType eventhorizon.CommandType) error
func ConvertToCommandTypes ¶
func ConvertToCommandTypes(commands []enum.Literal) []eventhorizon.CommandType
func ConvertToEventTypes ¶
func ConvertToEventTypes(events []enum.Literal) []eventhorizon.EventType
func EntityAlreadyExists ¶
func EntityAlreadyExists(entityId uuid.UUID, aggregateType eventhorizon.AggregateType) error
func EntityChildIdNotDefined ¶
func EntityChildIdNotDefined(entityId uuid.UUID, aggregateType eventhorizon.AggregateType, childType string) error
func EntityChildNotExists ¶
func EntityChildNotExists(entityId uuid.UUID, aggregateType eventhorizon.AggregateType, childId uuid.UUID, childType string) error
func EntityNotExists ¶
func EntityNotExists(entityId uuid.UUID, aggregateType eventhorizon.AggregateType) error
func EventHandlerNotImplemented ¶
func EventHandlerNotImplemented(eventType eventhorizon.EventType) error
func IdNotDefined ¶
func IdNotDefined(currentId uuid.UUID, aggregateType eventhorizon.AggregateType) error
func IdsDismatch ¶
func IdsDismatch(entityId uuid.UUID, currentId uuid.UUID, aggregateType eventhorizon.AggregateType) error
func QueryNotImplemented ¶
func ValidateIdsMatch ¶
func ValidateIdsMatch(entityId uuid.UUID, currentId uuid.UUID, aggregateType eventhorizon.AggregateType) (ret error)
func ValidateNewId ¶
func ValidateNewId(entityId uuid.UUID, currentId uuid.UUID, aggregateType eventhorizon.AggregateType) (ret error)
Types ¶
type AggregateEngine ¶
type AggregateEngine struct { *Middleware AggregateType eventhorizon.AggregateType AggregateFactory func(id uuid.UUID) eventhorizon.Aggregate EntityFactory func() eventhorizon.Entity Commands []eventhorizon.CommandType Events []eventhorizon.EventType // contains filtered or unexported fields }
func NewAggregateEngine ¶
func NewAggregateEngine(middelware *Middleware, aggregateType eventhorizon.AggregateType, aggregateFactory func(id uuid.UUID) eventhorizon.Aggregate, entityFactory func() eventhorizon.Entity, commands []enum.Literal, events []enum.Literal) (ret *AggregateEngine)
func (*AggregateEngine) RegisterForEvent ¶
func (o *AggregateEngine) RegisterForEvent(handler eventhorizon.EventHandler, event enum.Literal) (err error)
func (*AggregateEngine) RegisterForEvents ¶
func (o *AggregateEngine) RegisterForEvents(handler eventhorizon.EventHandler, events []eventhorizon.EventType) (err error)
func (*AggregateEngine) RegisterForEventsAll ¶
func (o *AggregateEngine) RegisterForEventsAll(handler eventhorizon.EventHandler) (err error)
func (*AggregateEngine) RegisterProjector ¶
func (o *AggregateEngine) RegisterProjector(projectorType string, listener DelegateEventHandler) (ret *ProjectorEventHandler, err error)
func (*AggregateEngine) RegisterSagaForEvents ¶
func (o *AggregateEngine) RegisterSagaForEvents(aSaga saga.Saga, events []eventhorizon.EventType) (err error)
func (*AggregateEngine) Setup ¶
func (o *AggregateEngine) Setup() (err error)
type AggregateStoreEvent ¶
type AggregateStoreEvent interface {
AppendEvent(eventhorizon.EventType, eventhorizon.EventData, time.Time, ...eventhorizon.EventOption) eventhorizon.Event
}
type CommandError ¶
func (CommandError) Cause ¶
func (o CommandError) Cause() error
func (CommandError) Error ¶
func (o CommandError) Error() string
type DelegateCommandHandler ¶
type DelegateCommandHandler interface { CommandTypes() []eventhorizon.CommandType Execute(cmd eventhorizon.Command, entity eventhorizon.Entity, store AggregateStoreEvent) error }
type DelegateEventHandler ¶
type DelegateEventHandler interface { EventTypes() []eventhorizon.EventType Apply(event eventhorizon.Event, entity eventhorizon.Entity) error }
type EventStoreDelegate ¶
type EventStoreDelegate struct { Factory func() (ret eventhorizon.EventStore, err error) // contains filtered or unexported fields }
func (*EventStoreDelegate) Close ¶
func (o *EventStoreDelegate) Close() (err error)
func (*EventStoreDelegate) Load ¶
func (o *EventStoreDelegate) Load(ctx context.Context, id uuid.UUID) (ret []eventhorizon.Event, err error)
func (*EventStoreDelegate) LoadFrom ¶
func (o *EventStoreDelegate) LoadFrom(ctx context.Context, id uuid.UUID, version int) ( ret []eventhorizon.Event, err error)
LoadFrom loads all events from version for the aggregate id from the store.
func (*EventStoreDelegate) Save ¶
func (o *EventStoreDelegate) Save(ctx context.Context, events []eventhorizon.Event, originalVersion int) (err error)
type HttpCommandHandler ¶
type HttpCommandHandler struct { Context context.Context CommandBus eventhorizon.CommandHandler }
func NewHttpCommandHandlerFull ¶
func NewHttpCommandHandlerFull( context context.Context, commandBus eventhorizon.CommandHandler) (ret *HttpCommandHandler)
func (*HttpCommandHandler) HandleCommand ¶
func (o *HttpCommandHandler) HandleCommand(command eventhorizon.Command, w http.ResponseWriter, r *http.Request)
type HttpQueryHandler ¶
type HttpQueryHandler struct { }
func NewHttpQueryHandlerFull ¶
func NewHttpQueryHandlerFull() (ret *HttpQueryHandler)
func (*HttpQueryHandler) HandleResult ¶
func (o *HttpQueryHandler) HandleResult( ret interface{}, err error, method string, w http.ResponseWriter, r *http.Request)
type Middleware ¶
type Middleware struct { EventStore eventhorizon.EventStore EventBus eventhorizon.EventBus CommandBus *bus.CommandHandler Repos func(string, func() (ret eventhorizon.Entity)) (ret eventhorizon.ReadWriteRepo, err error) }
type ProjectorEventHandler ¶
type ProjectorEventHandler struct { DelegateEventHandler Repo eventhorizon.ReadRepo // contains filtered or unexported fields }
func NewProjector ¶
func NewProjector(projectorType string, eventHandler DelegateEventHandler, repo eventhorizon.ReadRepo) (ret *ProjectorEventHandler)
func (*ProjectorEventHandler) Project ¶
func (o *ProjectorEventHandler) Project( ctx context.Context, event eventhorizon.Event, entity eventhorizon.Entity) (ret eventhorizon.Entity, err error)
func (*ProjectorEventHandler) ProjectorType ¶
func (o *ProjectorEventHandler) ProjectorType() projector.Type
Click to show internal directories.
Click to hide internal directories.