query

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventQueryOpts

func EventQueryOpts(q aggregate.Query) []query.Option

EventQueryOpts returns a slice of query.Option for an aggregate.Query, converting the aggregate query's names, IDs, and version constraints into corresponding event query options.

func Test

func Test[D any](q aggregate.Query, a aggregate.Aggregate) bool

Types

type Option

type Option func(*builder)

Option is a function that modifies a query builder. It allows to configure the aggregate Query by adding names, IDs, version constraints, and sorting options to the builder. Multiple Option functions can be combined to create complex queries.

func ID

func ID(ids ...uuid.UUID) Option

ID adds the specified UUIDs to the query, ensuring that only unique IDs are stored. The query will match aggregates with any of the provided IDs.

func Name

func Name(names ...string) Option

Name adds the specified names to the aggregate names filter in the query builder.

func SortBy

SortBy sets the sorting option for the aggregate query by specifying the sort field and direction. It replaces any existing sortings with the provided one.

func SortByMulti

func SortByMulti(sorts ...aggregate.SortOptions) Option

SortByMulti appends multiple aggregate.SortOptions to the sortings of a Query.

func Version

func Version(constraints ...version.Option) Option

Version adds the specified version constraints to the query, ensuring that only Aggregates with matching versions are included. The constraints are combined using the version package's Filter function.

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query is a filter for Aggregates based on their name, ID, version, and sorting options. It is used to selectively process Aggregates that match the specified criteria.

func Merge

func Merge(queries ...aggregate.Query) Query

Merge combines multiple aggregate.Query instances into a single Query. It merges the names, IDs, and version constraints of the provided queries and returns a new Query with the merged options.

func New

func New(opts ...Option) Query

New creates a Query with the provided options. The returned Query can be used to filter aggregates based on their name, ID, version, and sorting options.

func (Query) IDs

func (q Query) IDs() []uuid.UUID

IDs returns a slice of UUIDs that the Query filters by.

func (Query) Names

func (q Query) Names() []string

Names returns a slice of aggregate names that the Query targets.

func (Query) Sortings

func (q Query) Sortings() []aggregate.SortOptions

Sortings returns the sorting options of the Query. The returned sort options determine the order in which Aggregates should be sorted when processing the Query.

func (Query) Versions

func (q Query) Versions() version.Constraints

Versions returns the version constraints of the Query, which are used to filter aggregates based on their versions.

type Tagger

type Tagger interface {
	// HasTag checks if the specified tag is present in the Tagger interface. It
	// returns true if the tag is found, and false otherwise.
	HasTag(string) bool
}

Tagger is an interface that provides a method to check if a specific tag is present. It is used to filter aggregates based on their tags.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL