Documentation ¶
Overview ¶
Package query provides an event query builder.
Index ¶
- func Apply(q event.Query, events ...event.Event) []event.Event
- func Test(q event.Query, evt event.Event) bool
- type Option
- func Aggregate(name string, id uuid.UUID) Option
- func AggregateID(ids ...uuid.UUID) Option
- func AggregateName(names ...string) Option
- func AggregateVersion(constraints ...version.Option) Option
- func Aggregates(aggregates ...event.AggregateTuple) Option
- func ID(ids ...uuid.UUID) Option
- func Name(names ...string) Option
- func SortBy(sort event.Sorting, dir event.SortDirection) Option
- func SortByAggregate() Option
- func SortByMulti(sorts ...event.SortOptions) Option
- func SortByTime() Option
- func Time(constraints ...time.Option) Option
- type Query
- func (q Query) AggregateIDs() []uuid.UUID
- func (q Query) AggregateNames() []string
- func (q Query) AggregateVersions() version.Constraints
- func (q Query) Aggregates() []event.AggregateTuple
- func (q Query) IDs() []uuid.UUID
- func (q Query) Names() []string
- func (q Query) Sortings() []event.SortOptions
- func (q Query) Times() time.Constraints
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*builder)
Option is a Query option.
func AggregateID ¶
AggregateID returns an Option that filters events by their aggregate ids.
func AggregateName ¶
AggregateName returns an Option that filters events by their aggregate names.
func AggregateVersion ¶
AggregateVersion returns an Option that filters events by their aggregate versions.
func Aggregates ¶
func Aggregates(aggregates ...event.AggregateTuple) Option
Aggregates returns an Option that filters Events by specific Aggregates.
func SortBy ¶
func SortBy(sort event.Sorting, dir event.SortDirection) Option
SortBy returns an Option that sorts a Query by the given Sorting and SortDirection.
func SortByAggregate ¶
func SortByAggregate() Option
SortByAggregate returns an Option that sorts the a Query by aggregates.
Order of sortings is:
- AggregateName (ascending)
- AggregateID (ascending)
- AggregateVersion (ascending)
func SortByMulti ¶
func SortByMulti(sorts ...event.SortOptions) Option
SortByMulti return an Option that sorts a Query by multiple Sortings and SortDirections.
func SortByTime ¶
func SortByTime() Option
SortByTime returns an Option that sorts a Query by event time.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is used by event stores to filter events.
func Merge ¶
Merge merges multiple Queries and returns the merged Query.
In cases where only a single value can be assigned to a filter, the last provided Query that provides that filter is used.
func (Query) AggregateIDs ¶
AggregateIDs returns the aggregate ids to query for.
func (Query) AggregateNames ¶
AggregateNames returns the aggregate names to query for.
func (Query) AggregateVersions ¶
func (q Query) AggregateVersions() version.Constraints
AggregateVersions returns the aggregate versions to query for.
func (Query) Aggregates ¶
func (q Query) Aggregates() []event.AggregateTuple
Aggregates returns a slice of specific Aggregates to query for.
func (Query) Sortings ¶
func (q Query) Sortings() []event.SortOptions
Sortings returns the SortConfigs for the query.
func (Query) Times ¶
func (q Query) Times() time.Constraints
Times returns the time constraints. Times guarantees to return non-nil time.Constraints.