version

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 0 Imported by: 1

Documentation

Overview

Package version provides version constraints for queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Includes

func Includes(c Constraints, v ...int) bool

Includes determines if the Constraints c includes all of v.

Types

type Constraints

type Constraints interface {
	// Exact returns the exact versions to query for.
	Exact() []int

	// Ranges returns the version ranges to query for.
	Ranges() []Range

	// Min returns the minimum allowed versions to query for.
	Min() []int

	// Max returns the maximu allowed versions to query for.
	Max() []int
}

Constraints provides the different constraints for querying events. An event.Store that uses Constraints should combine the different types of constraints with a logical "AND" and the different values for a constraint with a logical "OR".

func Filter

func Filter(opts ...Option) Constraints

Filter returns Constraints from the given Constraint opts.

func Merge

func Merge(constraints ...Constraints) Constraints

Merge merges mutliple Constraints into one.

type Option

type Option func(*constraints)

A Option is an option for constraints.

func DryMerge

func DryMerge(constraints ...Constraints) []Option

DryMerge returns the Options to merge the provided Constraints.

func Exact

func Exact(v ...int) Option

Exact returns a Constraint that only allows the exact versions v.

func InRange

func InRange(r ...Range) Option

InRange returns a Constraint that only allows versions in the Ranges r.

func Max

func Max(v ...int) Option

Max returns a Constraint that only allows versions that are <= at least one of v.

func Min

func Min(v ...int) Option

Min returns a Constraint that only allows versions that are >= least one of v.

type Range

type Range [2]int

Range is a version range.

func (Range) End

func (r Range) End() int

End returns the end of the Range (r[1]).

func (Range) Includes

func (r Range) Includes(v int) bool

Includes returns true if v is within the Range r.

func (Range) Start

func (r Range) Start() int

Start returns the start of the Range (r[0]).

Jump to

Keyboard shortcuts

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