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
String returns the string format of the constraints.