model

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRepo is when a dispatcher is created with a nil repo.
	ErrInvalidRepo = errors.New("invalid repo")
	// ErrInvalidAggregate occurs when a loaded aggregate is not an aggregate.
	ErrInvalidAggregate = errors.New("invalid aggregate")
)

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, eventHandler eh.EventHandler) (*AggregateStore, error)

NewAggregateStore creates an aggregate store with a read write repo and an event handler that can handle any resulting events (for example by publishing them on an event bus).

func (*AggregateStore) Load

func (r *AggregateStore) Load(ctx context.Context, aggregateType eh.AggregateType, id uuid.UUID) (eh.Aggregate, error)

Load implements the Load method of the eventhorizon.AggregateStore interface.

func (*AggregateStore) Save

func (r *AggregateStore) Save(ctx context.Context, aggregate eh.Aggregate) error

Save implements the Save method of the eventhorizon.AggregateStore interface.

type SliceEventSource added in v1.0.1

type SliceEventSource []eh.Event

SliceEventSource is an eh.EventSource using a slice to store events.

func (*SliceEventSource) AppendEvent added in v1.0.1

func (a *SliceEventSource) AppendEvent(e eh.Event)

AppendEvent appends an event to be handled after the aggregate has been successfully saved.

func (*SliceEventSource) ClearUncommittedEvents added in v1.0.1

func (a *SliceEventSource) ClearUncommittedEvents()

ClearUncommittedEvents implements the ClearUncommittedEvents method of the eh.EventSource interface.

func (*SliceEventSource) UncommittedEvents added in v1.0.1

func (a *SliceEventSource) UncommittedEvents() []eh.Event

UncommittedEvents implements the UncommittedEvents method of the eh.EventSource interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL