Documentation ¶
Index ¶
- type EventStore
- type FactoryModelFunc
- type GoroutinePoolGoFunc
- type LogDebugfFunc
- type Model
- type Projection
- func (p *Projection) Forget(queries []SnapshotQuery) (err error)
- func (p *Projection) Handle(ctx context.Context, iter event.Iter) error
- func (p *Projection) HandleWithReload(ctx context.Context, iter event.Iter) error
- func (p *Projection) Models(queries []SnapshotQuery) []Model
- func (p *Projection) Project(ctx context.Context, queries []SnapshotQuery) (err error)
- type SnapshotQuery
- type VersionQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventStore ¶
type EventStore interface { Save(ctx context.Context, groupId string, aggregateId string, events []event.Event) (concurrencyException bool, err error) SaveSnapshot(ctx context.Context, groupId string, aggregateId string, event event.Event) (concurrencyException bool, err error) LoadUpToVersion(ctx context.Context, queries []VersionQuery, eventHandler event.Handler) error LoadFromVersion(ctx context.Context, queries []VersionQuery, eventHandler event.Handler) error LoadFromSnapshot(ctx context.Context, queries []SnapshotQuery, eventHandler event.Handler) error RemoveUpToVersion(ctx context.Context, queries []VersionQuery) error }
EventStore provides interface over eventstore. More aggregates can be grouped by groupId, but aggregateId of aggregates must be unique against whole DB.
type FactoryModelFunc ¶
FactoryModelFunc creates user model.
type GoroutinePoolGoFunc ¶
type GoroutinePoolGoFunc func(func()) error
GoroutinePoolGoFunc processes actions via provided function
type LogDebugfFunc ¶
type LogDebugfFunc func(fmt string, args ...interface{})
LogDebugfFunc log debug messages
type Projection ¶
type Projection struct { LogDebugfFunc LogDebugfFunc // contains filtered or unexported fields }
Projection projects events from eventstore to user model.
func NewProjection ¶
func NewProjection(store EventStore, factoryModel FactoryModelFunc, LogDebugfFunc LogDebugfFunc) *Projection
NewProjection projection over eventstore.
func (*Projection) Forget ¶
func (p *Projection) Forget(queries []SnapshotQuery) (err error)
Forget drop projection by query.Verson in Query is ignored.
func (*Projection) HandleWithReload ¶
HandleWithReload update projection by events and reload events if it is needed.
func (*Projection) Models ¶
func (p *Projection) Models(queries []SnapshotQuery) []Model
Models return models from projection.
func (*Projection) Project ¶
func (p *Projection) Project(ctx context.Context, queries []SnapshotQuery) (err error)
Project update projection from snapshots defined by query. Verson in Query is ignored.
type SnapshotQuery ¶
type SnapshotQuery struct { GroupId string //filter by group Id and it is used only when aggreagateId is empty AggregateId string //filter to certain aggregateId SnapshotEventType string //required }
SnapshotQuery used to load events from snapshot.
type VersionQuery ¶
VersionQuery used to load events from version.