21 lines
1.0 KiB
Go
Raw Normal View History

2020-09-30 10:00:05 +02:00
package repository
import (
"context"
)
2020-10-06 21:28:09 +02:00
//Repository pushes and filters events
2020-09-30 10:00:05 +02:00
type Repository interface {
2020-10-06 21:28:09 +02:00
//Health checks if the connection to the storage is available
2020-09-30 10:00:05 +02:00
Health(ctx context.Context) error
// PushEvents adds all events of the given aggregates to the eventstreams of the aggregates.
// if assets are pushed, they will be added to the assets table only referenced by id in eventstore (history)
// if unique constraints are pushed, they will be added to the unique table for checking unique constraint violations
2020-09-30 10:00:05 +02:00
// This call is transaction save. The transaction will be rolled back if one event fails
Push(ctx context.Context, events []*Event, assets []*Asset, uniqueConstraints ...*UniqueConstraint) error
2020-09-30 10:00:05 +02:00
// Filter returns all events matching the given search query
Filter(ctx context.Context, searchQuery *SearchQuery) (events []*Event, err error)
//LatestSequence returns the latests sequence found by the the search query
LatestSequence(ctx context.Context, queryFactory *SearchQuery) (uint64, error)
}