Documentation ¶
Index ¶
- func HandleRetry(ctx context.Context, retryFunc RetryFunc) error
- func NewAggrModel(ctx context.Context, groupID, aggregateID string, store eventstore.EventStore, ...) (*aggrModel, error)
- type Aggregate
- func (a *Aggregate) AggregateID() string
- func (a *Aggregate) FactoryModel(ctx context.Context) (AggregateModel, error)
- func (a *Aggregate) GroupID() string
- func (a *Aggregate) HandleCommand(ctx context.Context, cmd Command) ([]eventstore.Event, error)
- func (a *Aggregate) HandleCommandWithAggrModel(ctx context.Context, cmd Command, amodel *aggrModel) (events []eventstore.Event, concurrencyExcpetion bool, err error)
- type AggregateModel
- type Command
- type FactoryModelFunc
- type RetryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAggrModel ¶ added in v2.2.4
func NewAggrModel(ctx context.Context, groupID, aggregateID string, store eventstore.EventStore, logDebugfFunc eventstore.LogDebugfFunc, model AggregateModel) (*aggrModel, error)
Types ¶
type Aggregate ¶
type Aggregate struct { LogDebugfFunc eventstore.LogDebugfFunc // contains filtered or unexported fields }
Aggregate holds data for Handle command
func NewAggregate ¶
func NewAggregate(groupID, aggregateID string, retryFunc RetryFunc, numEventsInSnapshot int, store eventstore.EventStore, factoryModel FactoryModelFunc, LogDebugfFunc eventstore.LogDebugfFunc) (*Aggregate, error)
NewAggregate creates aggregate. it load and store events created from commands
func (*Aggregate) AggregateID ¶
func (*Aggregate) FactoryModel ¶ added in v2.2.4
func (a *Aggregate) FactoryModel(ctx context.Context) (AggregateModel, error)
func (*Aggregate) HandleCommand ¶
HandleCommand transforms command to a event, store and publish eventstore.
func (*Aggregate) HandleCommandWithAggrModel ¶ added in v2.2.4
type AggregateModel ¶
type AggregateModel = interface { eventstore.Model HandleCommand(ctx context.Context, cmd Command, newVersion uint64) ([]eventstore.Event, error) TakeSnapshot(version uint64) (snapshotEvent eventstore.Event, ok bool) GroupID() string //defines group where model belows }
AggregateModel user model for aggregate need to satisfy this interface.
type Command ¶
type Command = interface{}
Command user defined command that will handled in AggregateModel.HandleCommand
type FactoryModelFunc ¶
type FactoryModelFunc = func(ctx context.Context) (AggregateModel, error)
FactoryModelFunc creates model for aggregate
Click to show internal directories.
Click to hide internal directories.