semver

package
v0.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

semver is a Semver Constraints package copied from github.com/hashicorp/go-version @ 2046c9d0f0b03c779670f5186a2a4b2c85493a71

Unlike Constraints in go-version, Semver constraints use Semver 2.0 ordering rules and only accept properly formatted Semver versions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraint

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

Constraint represents a single constraint for a version, such as ">= 1.0".

func (*Constraint) Check

func (c *Constraint) Check(v *version.Version) bool

Check tests if a constraint is validated by the given version.

func (*Constraint) String

func (c *Constraint) String() string

type Constraints

type Constraints []*Constraint

Constraints is a slice of constraints. We make a custom type so that we can add methods to it.

func NewConstraint

func NewConstraint(v string) (Constraints, error)

NewConstraint will parse one or more constraints from the given constraint string. The string must be a comma-separated list of constraints.

func (Constraints) Check

func (cs Constraints) Check(v *version.Version) bool

Check tests if a version satisfies all the constraints.

func (Constraints) String

func (cs Constraints) String() string

Returns the string format of the constraints

Jump to

Keyboard shortcuts

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