Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
func New ¶
func New(s3Client *s3.Client, opts ...EventStoreOption) (*EventStore, error)
New creates a new event store using the given S3 client.
func (*EventStore) AppendStream ¶
func (s *EventStore) AppendStream(ctx context.Context, streamID typeid.UUID, events []*eventstore.WritableEvent, opts eventstore.AppendStreamOptions) error
AppendStream appends events to the specified stream.
func (*EventStore) ReadStream ¶
func (s *EventStore) ReadStream(ctx context.Context, streamID typeid.UUID, opts eventstore.ReadStreamOptions) (eventstore.StreamIterator, error)
ReadStream returns an iterator for reading events from the specified stream.
type EventStoreOption ¶
type EventStoreOption func(*EventStore) error
func WithLogger ¶
func WithLogger(logger *slog.Logger) EventStoreOption
WithLogger sets the logger to use for the event store.
The default logger is slog.Default().
func WithStrategy ¶
func WithStrategy(strategy Strategy) EventStoreOption
WithStrategy sets the strategy to use for the event store.
The default strategy is one collection per stream.
type Strategy ¶
type Strategy interface { GetStreamIterator( ctx context.Context, streamID typeid.UUID, opts eventstore.ReadStreamOptions, ) (eventstore.StreamIterator, error) InsertStreamEvents( ctx context.Context, streamID typeid.UUID, events []*eventstore.WritableEvent, opts eventstore.AppendStreamOptions, ) (*strategy.InsertStreamEventsResult, error) }
type TransactionHook ¶
type TransactionHook interface {
HandleEvents(sessCtx mongo.SessionContext, events []*eventstore.Event) error
}
Click to show internal directories.
Click to hide internal directories.