Documentation ¶
Overview ¶
package es implements an event store and drivers for extending its functionality.
Index ¶
- Constants
- Variables
- func Create[A any, T PA[A]](ctx context.Context, es *EventStore, streamID string, ...) (agg T, err error)
- func Init(ctx context.Context) error
- func Register(ctx context.Context, name string, d driver.Driver) error
- func Unwrap[T any](t T) T
- func Update[A any, T PA[A]](ctx context.Context, es *EventStore, streamID string, ...) (agg T, err error)
- func Upsert[A any, T PA[A]](ctx context.Context, es *EventStore, streamID string, ...) (agg T, err error)
- type EventStore
- func (es *EventStore) Append(ctx context.Context, streamID string, events event.Events) (uint64, error)
- func (es *EventStore) EventStream() driver.EventStream
- func (es *EventStore) FirstIndex(ctx context.Context, streamID string) (uint64, error)
- func (es *EventStore) LastIndex(ctx context.Context, streamID string) (uint64, error)
- func (es *EventStore) Load(ctx context.Context, agg event.Aggregate) error
- func (es *EventStore) Option(options ...Option)
- func (es *EventStore) Read(ctx context.Context, streamID string, after, count int64) (event.Events, error)
- func (es *EventStore) ReadN(ctx context.Context, streamID string, index ...uint64) (event.Events, error)
- func (es *EventStore) Save(ctx context.Context, agg event.Aggregate) (uint64, error)
- func (es *EventStore) Truncate(ctx context.Context, streamID string, index int64) error
- type Option
- type PA
- type PE
Constants ¶
View Source
const AllEvents = int64(AppendOnly >> 1)
View Source
const AppendOnly = ^uint64(0)
Variables ¶
View Source
var ( Mes_open metric.Int64Counter Mes_read metric.Int64Counter Mes_load metric.Int64Counter Mes_save metric.Int64Counter Mes_append metric.Int64Counter )
View Source
var ErrNoDriver = errors.New("no driver")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrShouldExist = event.ErrShouldExist
View Source
var ErrShouldNotExist = event.ErrShouldNotExist
View Source
var ErrWrongVersion = errors.New("wrong version")
Functions ¶
func Create ¶
func Create[A any, T PA[A]](ctx context.Context, es *EventStore, streamID string, fn func(context.Context, T) error) (agg T, err error)
Create uses fn to create a new aggregate and store in db.
Types ¶
type EventStore ¶
func (*EventStore) EventStream ¶
func (es *EventStore) EventStream() driver.EventStream
func (*EventStore) FirstIndex ¶
func (*EventStore) Option ¶
func (es *EventStore) Option(options ...Option)
type Option ¶
type Option interface {
Apply(*EventStore)
}
Directories ¶
Path | Synopsis |
---|---|
package driver defines interfaces to be used by driver implementations.
|
package driver defines interfaces to be used by driver implementations. |
mem-store
package memstore provides a driver that reads and writes events to memory.
|
package memstore provides a driver that reads and writes events to memory. |
projecter
package projecter provides a driver middleware to derive new events from other events.
|
package projecter provides a driver middleware to derive new events from other events. |
streamer
package streamer provides a driver to allow awaiting for new events to be added to a stream.
|
package streamer provides a driver to allow awaiting for new events to be added to a stream. |
package event implements functionality for working with an eventstore.
|
package event implements functionality for working with an eventstore. |
internal
|
|
Click to show internal directories.
Click to hide internal directories.