semver is a Semver Constraints package copied from @ 2046c9d0f0b03c779670f5186a2a4b2c85493a71

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



This section is empty.


This section is empty.


This section is empty.


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

Source Files