Documentation ¶
Index ¶
- func LoadEvent(v interface{}, event ddd.AggregateEvent) error
- func LoadSnapshot(v interface{}, snapshot Snapshot, version int) error
- func NewAggregate(id, name string) *aggregate
- func NewAggregateRepository[T EventSourcedAggregate](aggregateName string, registry registry.Registry, store AggregateStore) aggregateRepository[T]
- func SetVersion(version int) registry.BuildOption
- type Aggregate
- type AggregateRepository
- type AggregateStore
- type AggregateStoreMiddleware
- type EventApplier
- type EventCommitter
- type EventPublisher
- type EventSourcedAggregate
- type FakeAggregateRepository
- type MockAggregate
- func (_m *MockAggregate) AddEvent(_a0 string, _a1 ddd.EventPayload, _a2 ...ddd.EventOption)
- func (_m *MockAggregate) AggregateName() string
- func (_m *MockAggregate) ClearEvents()
- func (_m *MockAggregate) CommitEvents()
- func (_m *MockAggregate) Events() []ddd.AggregateEvent
- func (_m *MockAggregate) ID() string
- func (_m *MockAggregate) PendingVersion() int
- func (_m *MockAggregate) SetID(_a0 string)
- func (_m *MockAggregate) SetName(_a0 string)
- func (_m *MockAggregate) SetVersion(_a0 int)
- func (_m *MockAggregate) Version() int
- type MockAggregateRepository
- type MockAggregateStore
- type MockEventSourcedAggregate
- func (_m *MockEventSourcedAggregate) AddEvent(_a0 string, _a1 ddd.EventPayload, _a2 ...ddd.EventOption)
- func (_m *MockEventSourcedAggregate) AggregateName() string
- func (_m *MockEventSourcedAggregate) ApplyEvent(_a0 ddd.Event) error
- func (_m *MockEventSourcedAggregate) ClearEvents()
- func (_m *MockEventSourcedAggregate) CommitEvents()
- func (_m *MockEventSourcedAggregate) Events() []ddd.AggregateEvent
- func (_m *MockEventSourcedAggregate) ID() string
- func (_m *MockEventSourcedAggregate) PendingVersion() int
- func (_m *MockEventSourcedAggregate) Version() int
- type Snapshot
- type SnapshotApplier
- type Snapshotter
- type VersionSetter
- type Versioner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadEvent ¶
func LoadEvent(v interface{}, event ddd.AggregateEvent) error
func LoadSnapshot ¶
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 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
func NewEventPublisher ¶
func NewEventPublisher(publisher ddd.EventPublisher[ddd.AggregateEvent]) AggregateStoreMiddleware
type EventApplier ¶
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)
type MockAggregate ¶
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.
type MockAggregateStore ¶
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 ¶
func (_m *MockAggregateStore) Load(ctx context.Context, aggregate EventSourcedAggregate) error
Load provides a mock function with given fields: ctx, aggregate
func (*MockAggregateStore) Save ¶
func (_m *MockAggregateStore) Save(ctx context.Context, aggregate EventSourcedAggregate) error
Save provides a mock function with given fields: ctx, aggregate
type MockEventSourcedAggregate ¶
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 ¶
func (_m *MockEventSourcedAggregate) Events() []ddd.AggregateEvent
Events provides a mock function with given fields:
func (*MockEventSourcedAggregate) ID ¶
func (_m *MockEventSourcedAggregate) ID() string
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 SnapshotApplier ¶
type Snapshotter ¶
type Snapshotter interface { SnapshotApplier ToSnapshot() Snapshot }
type VersionSetter ¶
type VersionSetter interface {
SetVersion(int)
}