Documentation ¶
Index ¶
- func HandleRetry(ctx context.Context, retryFunc RetryFunc) 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) HandleCommandWithAggregateModelWrapper(ctx context.Context, cmd Command, amodel *AggregateModelWrapper) (events []eventstore.Event, concurrencyExcpetion bool, err error)
- type AggregateModel
- type AggregateModelWrapper
- func (ah *AggregateModelWrapper) GroupID() string
- func (ah *AggregateModelWrapper) Handle(ctx context.Context, iter eventstore.Iter) error
- func (ah *AggregateModelWrapper) HandleCommand(ctx context.Context, cmd Command, newVersion uint64) ([]eventstore.Event, error)
- func (ah *AggregateModelWrapper) TakeSnapshot(newVersion uint64) (eventstore.Event, bool)
- type Command
- type FactoryModelFunc
- type RetryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) HandleCommandWithAggregateModelWrapper ¶ added in v2.7.0
func (a *Aggregate) HandleCommandWithAggregateModelWrapper(ctx context.Context, cmd Command, amodel *AggregateModelWrapper) (events []eventstore.Event, concurrencyExcpetion bool, err error)
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 AggregateModelWrapper ¶ added in v2.7.0
type AggregateModelWrapper struct {
// contains filtered or unexported fields
}
func NewAggregateModel ¶ added in v2.7.0
func NewAggregateModel(ctx context.Context, groupID, aggregateID string, store eventstore.EventStore, logDebugfFunc eventstore.LogDebugfFunc, model AggregateModel) (*AggregateModelWrapper, error)
func (*AggregateModelWrapper) GroupID ¶ added in v2.7.0
func (ah *AggregateModelWrapper) GroupID() string
func (*AggregateModelWrapper) Handle ¶ added in v2.7.0
func (ah *AggregateModelWrapper) Handle(ctx context.Context, iter eventstore.Iter) error
func (*AggregateModelWrapper) HandleCommand ¶ added in v2.7.0
func (ah *AggregateModelWrapper) HandleCommand(ctx context.Context, cmd Command, newVersion uint64) ([]eventstore.Event, error)
func (*AggregateModelWrapper) TakeSnapshot ¶ added in v2.7.0
func (ah *AggregateModelWrapper) TakeSnapshot(newVersion uint64) (eventstore.Event, bool)
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.