Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDeleted = errors.New("Not found (was deleted)") ErrNoHistory = errors.New("No history found") )
Functions ¶
Types ¶
type AggregatorMock ¶
AggregatorMock is a mock
func CreateAggregatorMock ¶
func CreateAggregatorMock() *AggregatorMock
CreateAggregatorMock returns a aggregatorMock
func (AggregatorMock) On ¶
func (o AggregatorMock) On(ctx context.Context, event Event) error
On is a mock
func (AggregatorMock) SetAggregateID ¶
func (o AggregatorMock) SetAggregateID(id string)
SetAggregateID is not implemented
type Record ¶
type Record struct { AggregateID string `json:"aggregateId"` SequenceID string `json:"sequenceId"` Timestamp int64 `json:"timestamp"` Type string `json:"type"` Data []byte `json:"data"` UserID string `json:"userId"` }
Record is a store row
type Repository ¶
type Repository interface { Save(ctx context.Context, events ...Event) error SaveTransaction(ctx context.Context, events ...Event) (StoreTransaction, error) Load(ctx context.Context, id string, aggr Aggregate) (deleted bool, err error) }
Repository is a interface
func NewRepository ¶
func NewRepository(store Store, serializer Serializer) Repository
NewRepository returns a new repository
type RepositoryMock ¶
RepositoryMock is a mock
func CreateRepositoryMock ¶
func CreateRepositoryMock() *RepositoryMock
CreateRepositoryMock returns a repositoryMock
func (RepositoryMock) Load ¶
func (r RepositoryMock) Load(ctx context.Context, id string, aggr Aggregate) (deleted bool, err error)
Load is a mock
func (RepositoryMock) Save ¶
func (r RepositoryMock) Save(ctx context.Context, events ...Event) error
Save is a mock
func (RepositoryMock) SaveTransaction ¶ added in v1.2.0
func (r RepositoryMock) SaveTransaction(ctx context.Context, events ...Event) (StoreTransaction, error)
SaveTransaction is a mock
type Serializer ¶
type Serializer interface { Unmarshal(data []byte, eventType string) (event Event, err error) Marshal(event Event) (data []byte, err error) }
Serializer is a interface
type SerializerMock ¶
SerializerMock is a mock
func CreateSerializerMock ¶
func CreateSerializerMock() *SerializerMock
CreateSerializerMock returns a serializerMock
type Store ¶
type Store interface { NewTransaction(ctx context.Context, records ...Record) (StoreTransaction, error) Load(ctx context.Context, id string) (record []Record, err error) }
Store is a interface
type StoreMock ¶
StoreMock is a mock
func (StoreMock) NewTransaction ¶ added in v1.2.0
NewTransaction is a mock
type StoreTransaction ¶ added in v1.2.0
type StoreTransactionMock ¶ added in v1.2.0
StoreTransactionMock is a mock
func CreateStoreTransactionMock ¶ added in v1.2.0
func CreateStoreTransactionMock() *StoreTransactionMock
CreateStoreTransactionMock returns a store transaction mock
func (StoreTransactionMock) Commit ¶ added in v1.2.0
func (o StoreTransactionMock) Commit() error
Save is a mock
func (StoreTransactionMock) Rollback ¶ added in v1.2.0
func (o StoreTransactionMock) Rollback() error
Rollback is a mock
Click to show internal directories.
Click to hide internal directories.