es

package
v0.0.0-...-76fafce Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 5 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 NewAggregate

func NewAggregate(id, name string) *aggregate

func NewAggregateRepository

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

func SetVersion

func SetVersion(version int) registry.BuildOption

Types

type Aggregate

type Aggregate interface {
	ddd.Aggregate
	EventCommitter
	Versioner
	VersionSetter
}

type AggregateRepository

type AggregateRepository[T EventSourcedAggregate] interface {
	Load(ctx context.Context, aggregateID string) (agg T, err error)
	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 FakeAggregateRepository

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

func NewFakeAggregateRepository

func NewFakeAggregateRepository[T EventSourcedAggregate](aggregateName string, registry registry.Registry) *FakeAggregateRepository[T]

func (*FakeAggregateRepository[T]) Load

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

func (*FakeAggregateRepository[T]) Reset

func (r *FakeAggregateRepository[T]) Reset(aggregates ...T)

func (*FakeAggregateRepository[T]) Save

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

type MockAggregate

type MockAggregate struct {
	mock.Mock
}

MockAggregate is an autogenerated mock type for the Aggregate type

func NewMockAggregate

func NewMockAggregate(t mockConstructorTestingTNewMockAggregate) *MockAggregate

NewMockAggregate creates a new instance of MockAggregate. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockAggregate) AddEvent

func (_m *MockAggregate) AddEvent(_a0 string, _a1 ddd.EventPayload, _a2 ...ddd.EventOption)

AddEvent provides a mock function with given fields: _a0, _a1, _a2

func (*MockAggregate) AggregateName

func (_m *MockAggregate) AggregateName() string

AggregateName provides a mock function with given fields:

func (*MockAggregate) ClearEvents

func (_m *MockAggregate) ClearEvents()

ClearEvents provides a mock function with given fields:

func (*MockAggregate) CommitEvents

func (_m *MockAggregate) CommitEvents()

CommitEvents provides a mock function with given fields:

func (*MockAggregate) Events

func (_m *MockAggregate) Events() []ddd.AggregateEvent

Events provides a mock function with given fields:

func (*MockAggregate) ID

func (_m *MockAggregate) ID() string

ID provides a mock function with given fields:

func (*MockAggregate) PendingVersion

func (_m *MockAggregate) PendingVersion() int

PendingVersion provides a mock function with given fields:

func (*MockAggregate) SetID

func (_m *MockAggregate) SetID(_a0 string)

SetID provides a mock function with given fields: _a0

func (*MockAggregate) SetName

func (_m *MockAggregate) SetName(_a0 string)

SetName provides a mock function with given fields: _a0

func (*MockAggregate) SetVersion

func (_m *MockAggregate) SetVersion(_a0 int)

SetVersion provides a mock function with given fields: _a0

func (*MockAggregate) Version

func (_m *MockAggregate) Version() int

Version provides a mock function with given fields:

type MockAggregateRepository

type MockAggregateRepository[T EventSourcedAggregate] struct {
	mock.Mock
}

MockAggregateRepository is an autogenerated mock type for the AggregateRepository type

func NewMockAggregateRepository

func NewMockAggregateRepository[T EventSourcedAggregate](t mockConstructorTestingTNewMockAggregateRepository) *MockAggregateRepository[T]

NewMockAggregateRepository creates a new instance of MockAggregateRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockAggregateRepository[T]) Load

func (_m *MockAggregateRepository[T]) Load(ctx context.Context, aggregateID string) (T, error)

Load provides a mock function with given fields: ctx, aggregateID

func (*MockAggregateRepository[T]) Save

func (_m *MockAggregateRepository[T]) Save(ctx context.Context, aggregate T) error

Save provides a mock function with given fields: ctx, aggregate

type MockAggregateStore

type MockAggregateStore struct {
	mock.Mock
}

MockAggregateStore is an autogenerated mock type for the AggregateStore type

func NewMockAggregateStore

func NewMockAggregateStore(t mockConstructorTestingTNewMockAggregateStore) *MockAggregateStore

NewMockAggregateStore creates a new instance of MockAggregateStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockAggregateStore) Load

Load provides a mock function with given fields: ctx, aggregate

func (*MockAggregateStore) Save

Save provides a mock function with given fields: ctx, aggregate

type MockEventSourcedAggregate

type MockEventSourcedAggregate struct {
	mock.Mock
}

MockEventSourcedAggregate is an autogenerated mock type for the EventSourcedAggregate type

func NewMockEventSourcedAggregate

func NewMockEventSourcedAggregate(t mockConstructorTestingTNewMockEventSourcedAggregate) *MockEventSourcedAggregate

NewMockEventSourcedAggregate creates a new instance of MockEventSourcedAggregate. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockEventSourcedAggregate) AddEvent

func (_m *MockEventSourcedAggregate) AddEvent(_a0 string, _a1 ddd.EventPayload, _a2 ...ddd.EventOption)

AddEvent provides a mock function with given fields: _a0, _a1, _a2

func (*MockEventSourcedAggregate) AggregateName

func (_m *MockEventSourcedAggregate) AggregateName() string

AggregateName provides a mock function with given fields:

func (*MockEventSourcedAggregate) ApplyEvent

func (_m *MockEventSourcedAggregate) ApplyEvent(_a0 ddd.Event) error

ApplyEvent provides a mock function with given fields: _a0

func (*MockEventSourcedAggregate) ClearEvents

func (_m *MockEventSourcedAggregate) ClearEvents()

ClearEvents provides a mock function with given fields:

func (*MockEventSourcedAggregate) CommitEvents

func (_m *MockEventSourcedAggregate) CommitEvents()

CommitEvents provides a mock function with given fields:

func (*MockEventSourcedAggregate) Events

Events provides a mock function with given fields:

func (*MockEventSourcedAggregate) ID

ID provides a mock function with given fields:

func (*MockEventSourcedAggregate) PendingVersion

func (_m *MockEventSourcedAggregate) PendingVersion() int

PendingVersion provides a mock function with given fields:

func (*MockEventSourcedAggregate) Version

func (_m *MockEventSourcedAggregate) Version() int

Version provides a mock function with given fields:

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 {
	SetVersion(int)
}

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