Documentation ¶
Index ¶
- Constants
- func NewAggregate(id, name string) *aggregate
- func NewEntity(id, name string) *entity
- func SetEvents(events ...Event) registry.BuildOption
- func SetID(id string) registry.BuildOption
- func SetName(name string) registry.BuildOption
- type Aggregate
- type AggregateEvent
- type AggregateNamer
- type Command
- type CommandHandler
- type CommandHandlerFunc
- type CommandOption
- type CommandPayload
- type Entity
- type EntityNamer
- type Event
- type EventDispatcher
- type EventHandler
- type EventHandlerFunc
- type EventOption
- type EventPayload
- type EventPublisher
- type EventSubscriber
- type Eventer
- type EventsSetter
- type IDSetter
- type IDer
- type Metadata
- type MockAggregate
- func (_m *MockAggregate) AddEvent(_a0 string, _a1 EventPayload, _a2 ...EventOption)
- func (_m *MockAggregate) AggregateName() string
- func (_m *MockAggregate) ClearEvents()
- func (_m *MockAggregate) Events() []AggregateEvent
- func (_m *MockAggregate) ID() string
- func (_m *MockAggregate) SetID(_a0 string)
- func (_m *MockAggregate) SetName(_a0 string)
- type MockCommandHandler
- type MockEntity
- type MockEventHandler
- type MockEventPublisher
- type MockEventSubscriber
- type MockReplyHandler
- type NameSetter
- type Reply
- type ReplyHandler
- type ReplyHandlerFunc
- type ReplyOption
- type ReplyPayload
Constants ¶
const ( AggregateNameKey = "aggregate-name" AggregateIDKey = "aggregate-id" AggregateVersionKey = "aggregate-version" )
Variables ¶
This section is empty.
Functions ¶
func NewAggregate ¶
func NewAggregate(id, name string) *aggregate
func SetEvents ¶
func SetEvents(events ...Event) registry.BuildOption
func SetID ¶
func SetID(id string) registry.BuildOption
func SetName ¶
func SetName(name string) registry.BuildOption
Types ¶
type Aggregate ¶
type Aggregate interface { IDer AggregateNamer Eventer IDSetter NameSetter }
type AggregateEvent ¶
type AggregateNamer ¶
type AggregateNamer interface {
AggregateName() string
}
type Command ¶
type Command interface { IDer CommandName() string Payload() CommandPayload Metadata() Metadata OccurredAt() time.Time }
func NewCommand ¶
func NewCommand(name string, payload CommandPayload, options ...CommandOption) Command
type CommandHandler ¶
type CommandHandlerFunc ¶
func (CommandHandlerFunc[T]) HandleCommand ¶
type CommandOption ¶
type CommandOption interface {
// contains filtered or unexported methods
}
type CommandPayload ¶
type CommandPayload any
type Entity ¶
type Entity interface { IDer EntityNamer IDSetter NameSetter }
type EntityNamer ¶
type EntityNamer interface {
EntityName() string
}
type Event ¶
type Event interface { IDer EventName() string Payload() EventPayload Metadata() Metadata OccurredAt() time.Time }
func NewEvent ¶
func NewEvent(name string, payload EventPayload, options ...EventOption) Event
type EventDispatcher ¶
type EventDispatcher[T Event] struct { // contains filtered or unexported fields }
func NewEventDispatcher ¶
func NewEventDispatcher[T Event]() *EventDispatcher[T]
func (*EventDispatcher[T]) Subscribe ¶
func (h *EventDispatcher[T]) Subscribe(handler EventHandler[T], events ...string)
type EventHandler ¶
type EventHandlerFunc ¶
func (EventHandlerFunc[T]) HandleEvent ¶
type EventOption ¶
type EventOption interface {
// contains filtered or unexported methods
}
type EventPayload ¶
type EventPayload interface{}
type EventPublisher ¶
type EventSubscriber ¶
type EventSubscriber[T Event] interface { Subscribe(handler EventHandler[T], events ...string) }
type Eventer ¶
type Eventer interface { AddEvent(string, EventPayload, ...EventOption) Events() []AggregateEvent ClearEvents() }
type EventsSetter ¶
type EventsSetter interface {
// contains filtered or unexported methods
}
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 EventPayload, _a2 ...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) Events ¶
func (_m *MockAggregate) Events() []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) 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
type MockCommandHandler ¶
MockCommandHandler is an autogenerated mock type for the CommandHandler type
func NewMockCommandHandler ¶
func NewMockCommandHandler[T Command](t mockConstructorTestingTNewMockCommandHandler) *MockCommandHandler[T]
NewMockCommandHandler creates a new instance of MockCommandHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockCommandHandler[T]) HandleCommand ¶
func (_m *MockCommandHandler[T]) HandleCommand(ctx context.Context, cmd T) (Reply, error)
HandleCommand provides a mock function with given fields: ctx, cmd
type MockEntity ¶
MockEntity is an autogenerated mock type for the Entity type
func NewMockEntity ¶
func NewMockEntity(t mockConstructorTestingTNewMockEntity) *MockEntity
NewMockEntity creates a new instance of MockEntity. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockEntity) EntityName ¶
func (_m *MockEntity) EntityName() string
EntityName provides a mock function with given fields:
func (*MockEntity) ID ¶
func (_m *MockEntity) ID() string
ID provides a mock function with given fields:
func (*MockEntity) SetID ¶
func (_m *MockEntity) SetID(_a0 string)
SetID provides a mock function with given fields: _a0
func (*MockEntity) SetName ¶
func (_m *MockEntity) SetName(_a0 string)
SetName provides a mock function with given fields: _a0
type MockEventHandler ¶
MockEventHandler is an autogenerated mock type for the EventHandler type
func NewMockEventHandler ¶
func NewMockEventHandler[T Event](t mockConstructorTestingTNewMockEventHandler) *MockEventHandler[T]
NewMockEventHandler creates a new instance of MockEventHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockEventHandler[T]) HandleEvent ¶
func (_m *MockEventHandler[T]) HandleEvent(ctx context.Context, event T) error
HandleEvent provides a mock function with given fields: ctx, event
type MockEventPublisher ¶
MockEventPublisher is an autogenerated mock type for the EventPublisher type
func NewMockEventPublisher ¶
func NewMockEventPublisher[T Event](t mockConstructorTestingTNewMockEventPublisher) *MockEventPublisher[T]
NewMockEventPublisher creates a new instance of MockEventPublisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
type MockEventSubscriber ¶
MockEventSubscriber is an autogenerated mock type for the EventSubscriber type
func NewMockEventSubscriber ¶
func NewMockEventSubscriber[T Event](t mockConstructorTestingTNewMockEventSubscriber) *MockEventSubscriber[T]
NewMockEventSubscriber creates a new instance of MockEventSubscriber. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockEventSubscriber[T]) Subscribe ¶
func (_m *MockEventSubscriber[T]) Subscribe(handler EventHandler[T], events ...string)
Subscribe provides a mock function with given fields: handler, events
type MockReplyHandler ¶
MockReplyHandler is an autogenerated mock type for the ReplyHandler type
func NewMockReplyHandler ¶
func NewMockReplyHandler[T Reply](t mockConstructorTestingTNewMockReplyHandler) *MockReplyHandler[T]
NewMockReplyHandler creates a new instance of MockReplyHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockReplyHandler[T]) HandleReply ¶
func (_m *MockReplyHandler[T]) HandleReply(ctx context.Context, reply T) error
HandleReply provides a mock function with given fields: ctx, reply
type NameSetter ¶
type NameSetter interface {
SetName(string)
}
type Reply ¶
type ReplyHandler ¶
type ReplyHandlerFunc ¶
func (ReplyHandlerFunc[T]) HandleReply ¶
type ReplyOption ¶
type ReplyOption interface {
// contains filtered or unexported methods
}
type ReplyPayload ¶
type ReplyPayload any