version

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: Apache-2.0 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 are the version constraints for an event query. Methods of Constraints that return non-nil filters must all be fulfilled by an event to be included in the query result. If a filter allows multiple values, the event must match at least one of the values.

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 defines a version constraint.

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