Documentation
¶
Index ¶
- type BackgroundContextStrategy
- func (s *BackgroundContextStrategy) Append() (context.Context, context.CancelFunc)
- func (s *BackgroundContextStrategy) CountEventsFor() (context.Context, context.CancelFunc)
- func (s *BackgroundContextStrategy) CreateIndices() (context.Context, context.CancelFunc)
- func (s *BackgroundContextStrategy) FromVersion() (context.Context, context.CancelFunc)
- func (s *BackgroundContextStrategy) GetEventsFor() (context.Context, context.CancelFunc)
- type ContextStrategy
- type EventStore
- func (s *EventStore) Append(events *goengine.EventStream) error
- func (s *EventStore) CountEventsFor(streamName goengine.StreamName, id string) (int64, error)
- func (s *EventStore) FromVersion(streamName goengine.StreamName, id string, version int) (*goengine.EventStream, error)
- func (s *EventStore) GetEventsFor(streamName goengine.StreamName, id string) (*goengine.EventStream, error)
- type MongoEvent
- type Option
- type TimeoutContextStrategy
- func (s *TimeoutContextStrategy) Append() (context.Context, context.CancelFunc)
- func (s *TimeoutContextStrategy) CountEventsFor() (context.Context, context.CancelFunc)
- func (s *TimeoutContextStrategy) CreateIndices() (context.Context, context.CancelFunc)
- func (s *TimeoutContextStrategy) FromVersion() (context.Context, context.CancelFunc)
- func (s *TimeoutContextStrategy) GetEventsFor() (context.Context, context.CancelFunc)
- type TimeoutContextStrategyOption
- func NewAppendTimeout(timeout time.Duration) TimeoutContextStrategyOption
- func NewCountEventsForTimeout(timeout time.Duration) TimeoutContextStrategyOption
- func NewCreateIndicesTimeout(timeout time.Duration) TimeoutContextStrategyOption
- func NewFromVersionTimeout(timeout time.Duration) TimeoutContextStrategyOption
- func NewGetEventsForTimeout(timeout time.Duration) TimeoutContextStrategyOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackgroundContextStrategy ¶
type BackgroundContextStrategy struct {
// contains filtered or unexported fields
}
BackgroundContextStrategy is the ContextStrategy implementation that always returns Background context and noop cancel
func NewBackgroundContextStrategy ¶
func NewBackgroundContextStrategy() *BackgroundContextStrategy
NewBackgroundContextStrategy instantiates new BackgroundContextStrategy
func (*BackgroundContextStrategy) Append ¶
func (s *BackgroundContextStrategy) Append() (context.Context, context.CancelFunc)
Append is the ContextStrategy.Append() implementation
func (*BackgroundContextStrategy) CountEventsFor ¶
func (s *BackgroundContextStrategy) CountEventsFor() (context.Context, context.CancelFunc)
CountEventsFor is the ContextStrategy.CountEventsFor() implementation
func (*BackgroundContextStrategy) CreateIndices ¶
func (s *BackgroundContextStrategy) CreateIndices() (context.Context, context.CancelFunc)
CreateIndices is the ContextStrategy.CreateIndices() implementation
func (*BackgroundContextStrategy) FromVersion ¶
func (s *BackgroundContextStrategy) FromVersion() (context.Context, context.CancelFunc)
FromVersion is the ContextStrategy.FromVersion() implementation
func (*BackgroundContextStrategy) GetEventsFor ¶
func (s *BackgroundContextStrategy) GetEventsFor() (context.Context, context.CancelFunc)
GetEventsFor is the ContextStrategy.GetEventsFor() implementation
type ContextStrategy ¶
type ContextStrategy interface {
Append() (context.Context, context.CancelFunc)
GetEventsFor() (context.Context, context.CancelFunc)
FromVersion() (context.Context, context.CancelFunc)
CountEventsFor() (context.Context, context.CancelFunc)
CreateIndices() (context.Context, context.CancelFunc)
}
ContextStrategy is an interface that represents strategy for providing contexts for corresponding MongoDB EventStore instance queries to MongoDB
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
EventStore The mongodb event store
func NewEventStore ¶
func NewEventStore(mongoDB *mongo.Database, registry goengine.TypeRegistry, options ...Option) *EventStore
NewEventStore creates new MongoDB based event store
func (*EventStore) Append ¶
func (s *EventStore) Append(events *goengine.EventStream) error
Append adds an event to the event store
func (*EventStore) CountEventsFor ¶
func (s *EventStore) CountEventsFor(streamName goengine.StreamName, id string) (int64, error)
CountEventsFor counts events for an id on the specified stream
func (*EventStore) FromVersion ¶
func (s *EventStore) FromVersion(streamName goengine.StreamName, id string, version int) (*goengine.EventStream, error)
FromVersion gets events for an id and version on the specified stream
func (*EventStore) GetEventsFor ¶
func (s *EventStore) GetEventsFor(streamName goengine.StreamName, id string) (*goengine.EventStream, error)
GetEventsFor gets events for an id on the specified stream
type MongoEvent ¶
type MongoEvent struct {
ID string `bson:"aggregate_id,omitempty"`
Version int `bson:"version"`
Type string `bson:"type"`
Payload string `bson:"payload"`
RecordedOn time.Time `bson:"recorded_on"`
}
MongoEvent represents an event on mongodb
type Option ¶
type Option func(eventStore *EventStore)
Option is the options type to configure MongoDB EventStore implementation creation
func ContextBackground ¶
func ContextBackground() Option
ContextBackground sets Context Strategy for EventStore to BackgroundContextStrategy
func ContextTimeout ¶
func ContextTimeout(options ...TimeoutContextStrategyOption) Option
ContextTimeout sets Context Strategy for EventStore to TimeoutContextStrategy
type TimeoutContextStrategy ¶
type TimeoutContextStrategy struct {
// contains filtered or unexported fields
}
TimeoutContextStrategy is the ContextStrategy implementation that returns configurable WithTimeout context and its cancel
func NewTimeoutContextStrategy ¶
func NewTimeoutContextStrategy(options ...TimeoutContextStrategyOption) *TimeoutContextStrategy
NewTimeoutContextStrategy instantiates new TimeoutContextStrategy
func (*TimeoutContextStrategy) Append ¶
func (s *TimeoutContextStrategy) Append() (context.Context, context.CancelFunc)
Append is the ContextStrategy.Append() implementation
func (*TimeoutContextStrategy) CountEventsFor ¶
func (s *TimeoutContextStrategy) CountEventsFor() (context.Context, context.CancelFunc)
CountEventsFor is the ContextStrategy.CountEventsFor() implementation
func (*TimeoutContextStrategy) CreateIndices ¶
func (s *TimeoutContextStrategy) CreateIndices() (context.Context, context.CancelFunc)
CreateIndices is the ContextStrategy.CreateIndices() implementation
func (*TimeoutContextStrategy) FromVersion ¶
func (s *TimeoutContextStrategy) FromVersion() (context.Context, context.CancelFunc)
FromVersion is the ContextStrategy.FromVersion() implementation
func (*TimeoutContextStrategy) GetEventsFor ¶
func (s *TimeoutContextStrategy) GetEventsFor() (context.Context, context.CancelFunc)
GetEventsFor is the ContextStrategy.GetEventsFor() implementation
type TimeoutContextStrategyOption ¶
type TimeoutContextStrategyOption func(s *TimeoutContextStrategy)
TimeoutContextStrategyOption is the options type to configure TimeoutContextStrategy creation
func NewAppendTimeout ¶
func NewAppendTimeout(timeout time.Duration) TimeoutContextStrategyOption
NewAppendTimeout is the TimeoutContextStrategy configuration option to set a timeout for Append call
func NewCountEventsForTimeout ¶
func NewCountEventsForTimeout(timeout time.Duration) TimeoutContextStrategyOption
NewCountEventsForTimeout is the TimeoutContextStrategy configuration option to set a timeout for CountEventsFor call
func NewCreateIndicesTimeout ¶
func NewCreateIndicesTimeout(timeout time.Duration) TimeoutContextStrategyOption
NewCreateIndicesTimeout is the TimeoutContextStrategy configuration option to set a timeout for CreateIndices call
func NewFromVersionTimeout ¶
func NewFromVersionTimeout(timeout time.Duration) TimeoutContextStrategyOption
NewFromVersionTimeout is the TimeoutContextStrategy configuration option to set a timeout for FromVersion call
func NewGetEventsForTimeout ¶
func NewGetEventsForTimeout(timeout time.Duration) TimeoutContextStrategyOption
NewGetEventsForTimeout is the TimeoutContextStrategy configuration option to set a timeout for GetEventsFor call