Documentation ¶
Index ¶
- Variables
- type EventStore
- func (s *EventStore) CreateTable(ctx context.Context) error
- func (s *EventStore) DeleteTable(ctx context.Context) error
- func (s *EventStore) Load(ctx context.Context, id uuid.UUID) ([]eh.Event, error)
- func (s *EventStore) LoadAll(ctx context.Context) ([]eh.Event, error)
- func (s *EventStore) RenameEvent(ctx context.Context, from, to eh.EventType) error
- func (s *EventStore) Replace(ctx context.Context, event eh.Event) error
- func (s *EventStore) Save(ctx context.Context, events []eh.Event, originalVersion int) error
- func (s *EventStore) TableName(ctx context.Context) string
- type EventStoreConfig
- type IndexInput
- type Repo
- func (r *Repo) Find(ctx context.Context, id uuid.UUID) (eh.Entity, error)
- func (r *Repo) FindAll(ctx context.Context) ([]eh.Entity, error)
- func (r *Repo) FindWithFilter(ctx context.Context, expr string, args ...interface{}) ([]eh.Entity, error)
- func (r *Repo) FindWithFilterUsingIndex(ctx context.Context, indexInput IndexInput, filterQuery string, ...) ([]eh.Entity, error)
- func (r *Repo) Parent() eh.ReadRepo
- func (r *Repo) Remove(ctx context.Context, id uuid.UUID) error
- func (r *Repo) Save(ctx context.Context, entity eh.Entity) error
- func (r *Repo) SetEntityFactory(f func() eh.Entity)
- type RepoConfig
Constants ¶
This section is empty.
Variables ¶
var ErrCouldNotClearDB = errors.New("could not clear database")
ErrCouldNotClearDB is when the database could not be cleared.
var ErrCouldNotDialDB = errors.New("could not dial database")
ErrCouldNotDialDB is when the database could not be dialed.
var ErrCouldNotMarshalEvent = errors.New("could not marshal event")
ErrCouldNotMarshalEvent is when an event could not be marshaled into BSON.
var ErrCouldNotSaveAggregate = errors.New("could not save aggregate")
ErrCouldNotSaveAggregate is when an aggregate could not be saved.
var ErrCouldNotUnmarshalEvent = errors.New("could not unmarshal event")
ErrCouldNotUnmarshalEvent is when an event could not be unmarshaled into a concrete type.
var ErrModelNotSet = errors.New("model not set")
ErrModelNotSet is when an model factory is not set on the Repo.
Functions ¶
This section is empty.
Types ¶
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
EventStore implements an EventStore for DynamoDB.
func NewEventStore ¶
func NewEventStore(config *EventStoreConfig) (*EventStore, error)
NewEventStore creates a new EventStore.
func NewEventStoreWithDB ¶ added in v0.1.2
func NewEventStoreWithDB(config *EventStoreConfig, db *dynamo.DB) *EventStore
NewEventStoreWithDB creates a new EventStore with DB
func (*EventStore) CreateTable ¶
func (s *EventStore) CreateTable(ctx context.Context) error
CreateTable creates the table if it is not already existing and correct.
func (*EventStore) DeleteTable ¶
func (s *EventStore) DeleteTable(ctx context.Context) error
DeleteTable deletes the event table.
func (*EventStore) LoadAll ¶ added in v0.1.4
LoadAll will load all the events from the event store (useful to replay events)
func (*EventStore) RenameEvent ¶
RenameEvent implements the RenameEvent method of the eventhorizon.EventStore interface.
func (*EventStore) Replace ¶
Replace implements the Replace method of the eventhorizon.EventStore interface.
type EventStoreConfig ¶
EventStoreConfig is a config for the DynamoDB event store.
type IndexInput ¶ added in v0.1.5
type IndexInput struct { IndexName string PartitionKey string PartitionKeyValue interface{} SortKey string SortKeyValue interface{} }
IndexInput is all the params we need to filter on an index
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo implements a DynamoDB repository for entities.
func (*Repo) FindAll ¶
FindAll implements the FindAll method of the eventhorizon.ReadRepo interface.
func (*Repo) FindWithFilter ¶ added in v0.1.2
func (r *Repo) FindWithFilter(ctx context.Context, expr string, args ...interface{}) ([]eh.Entity, error)
FindWithFilter allows to find entities with a filter
func (*Repo) FindWithFilterUsingIndex ¶ added in v0.1.5
func (r *Repo) FindWithFilterUsingIndex(ctx context.Context, indexInput IndexInput, filterQuery string, filterArgs ...interface{}) ([]eh.Entity, error)
FindWithFilterUsingIndex allows to find entities with a filter using an index
func (*Repo) SetEntityFactory ¶
SetEntityFactory sets a factory function that creates concrete entity types.
type RepoConfig ¶
RepoConfig is a config for the DynamoDB event store.