es

package
v0.0.0-...-1294fdc Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEvent

func LoadEvent(v interface{}, event ddd.AggregateEvent) error

func LoadSnapshot

func LoadSnapshot(v interface{}, snapshot Snapshot, version int) error

func SetVersion

func SetVersion(version int) registry.BuildOption

Types

type Aggregate

type Aggregate struct {
	ddd.Aggregate
	// contains filtered or unexported fields
}

func NewAggregate

func NewAggregate(id, name string) Aggregate

func (*Aggregate) AddEvent

func (a *Aggregate) AddEvent(name string, payload ddd.EventPayload, options ...ddd.EventOption)

func (*Aggregate) CommitEvents

func (a *Aggregate) CommitEvents()

func (Aggregate) PendingVersion

func (a Aggregate) PendingVersion() int

func (Aggregate) Version

func (a Aggregate) Version() int

type AggregateRepository

type AggregateRepository[T EventSourcedAggregate] struct {
	// contains filtered or unexported fields
}

func NewAggregateRepository

func NewAggregateRepository[T EventSourcedAggregate](aggregateName string, registry registry.Registry, store AggregateStore) AggregateRepository[T]

func (AggregateRepository[T]) Load

func (r AggregateRepository[T]) Load(ctx context.Context, aggregateID string) (agg T, err error)

func (AggregateRepository[T]) Save

func (r AggregateRepository[T]) Save(ctx context.Context, aggregate T) error

type AggregateStore

type AggregateStore interface {
	Load(ctx context.Context, aggregate EventSourcedAggregate) error
	Save(ctx context.Context, aggregate EventSourcedAggregate) error
}

func AggregateStoreWithMiddleware

func AggregateStoreWithMiddleware(store AggregateStore, mws ...AggregateStoreMiddleware) AggregateStore

type AggregateStoreMiddleware

type AggregateStoreMiddleware func(store AggregateStore) AggregateStore

type EventApplier

type EventApplier interface {
	ApplyEvent(ddd.Event) error
}

type EventCommitter

type EventCommitter interface {
	CommitEvents()
}

type EventPublisher

type EventPublisher struct {
	AggregateStore
	// contains filtered or unexported fields
}

func (EventPublisher) Save

func (p EventPublisher) Save(ctx context.Context, aggregate EventSourcedAggregate) error

type EventSourcedAggregate

type EventSourcedAggregate interface {
	ddd.IDer
	AggregateName() string
	ddd.Eventer
	Versioner
	EventApplier
	EventCommitter
}

type Snapshot

type Snapshot interface {
	SnapshotName() string
}

type SnapshotApplier

type SnapshotApplier interface {
	ApplySnapshot(snapshot Snapshot) error
}

type Snapshotter

type Snapshotter interface {
	SnapshotApplier
	ToSnapshot() Snapshot
}

type VersionSetter

type VersionSetter interface {
	// contains filtered or unexported methods
}

type Versioner

type Versioner interface {
	Version() int
	PendingVersion() int
}

Jump to

Keyboard shortcuts

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