Documentation ¶
Index ¶
- Variables
- type EventStore
- type ReadRepository
- type TraceEventStore
- func (s *TraceEventStore) GetTrace() []eventhorizon.Event
- func (s *TraceEventStore) Load(id eventhorizon.UUID) ([]eventhorizon.Event, error)
- func (s *TraceEventStore) ResetTrace()
- func (s *TraceEventStore) Save(events []eventhorizon.Event) error
- func (s *TraceEventStore) StartTracing()
- func (s *TraceEventStore) StopTracing()
Constants ¶
This section is empty.
Variables ¶
var ErrNoEventStoreDefined = errors.New("no event store defined")
ErrNoEventStoreDefined is if no event store has been defined.
Functions ¶
This section is empty.
Types ¶
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
EventStore implements EventStore as an in memory structure.
func NewEventStore ¶
func NewEventStore(eventBus eventhorizon.EventBus) *EventStore
NewEventStore creates a new EventStore.
func (*EventStore) Load ¶
func (s *EventStore) Load(id eventhorizon.UUID) ([]eventhorizon.Event, error)
Load loads all events for the aggregate id from the memory store. Returns ErrNoEventsFound if no events can be found.
func (*EventStore) Save ¶
func (s *EventStore) Save(events []eventhorizon.Event) error
Save appends all events in the event stream to the memory store.
type ReadRepository ¶
type ReadRepository struct {
// contains filtered or unexported fields
}
ReadRepository implements an in memory repository of read models.
func NewReadRepository ¶
func NewReadRepository() *ReadRepository
NewReadRepository creates a new ReadRepository.
func (*ReadRepository) Find ¶
func (r *ReadRepository) Find(id eventhorizon.UUID) (interface{}, error)
Find returns one read model with using an id. Returns ErrModelNotFound if no model could be found.
func (*ReadRepository) FindAll ¶
func (r *ReadRepository) FindAll() ([]interface{}, error)
FindAll returns all read models in the repository.
func (*ReadRepository) Remove ¶
func (r *ReadRepository) Remove(id eventhorizon.UUID) error
Remove removes a read model with id from the repository. Returns ErrModelNotFound if no model could be found.
func (*ReadRepository) Save ¶
func (r *ReadRepository) Save(id eventhorizon.UUID, model interface{}) error
Save saves a read model with id to the repository.
type TraceEventStore ¶
type TraceEventStore struct {
// contains filtered or unexported fields
}
TraceEventStore wraps an EventStore and adds debug tracing.
func NewTraceEventStore ¶
func NewTraceEventStore(eventStore eventhorizon.EventStore) *TraceEventStore
NewTraceEventStore creates a new TraceEventStore.
func (*TraceEventStore) GetTrace ¶
func (s *TraceEventStore) GetTrace() []eventhorizon.Event
GetTrace returns the events that happened during the tracing.
func (*TraceEventStore) Load ¶
func (s *TraceEventStore) Load(id eventhorizon.UUID) ([]eventhorizon.Event, error)
Load loads all events for the aggregate id from the base store. Returns ErrNoEventStoreDefined if no event store could be found.
func (*TraceEventStore) ResetTrace ¶
func (s *TraceEventStore) ResetTrace()
ResetTrace resets the trace.
func (*TraceEventStore) Save ¶
func (s *TraceEventStore) Save(events []eventhorizon.Event) error
Save appends all events to the base store and trace them if enabled.
func (*TraceEventStore) StartTracing ¶
func (s *TraceEventStore) StartTracing()
StartTracing starts the tracing of events.
func (*TraceEventStore) StopTracing ¶
func (s *TraceEventStore) StopTracing()
StopTracing stops the tracing of events.