Documentation ¶
Index ¶
- type Collection
- type Constraint
- type Constraints
- type Version
- func (v Version) CaretBump() Version
- func (v Version) Compare(other Version) int
- func (v Version) Equal(o Version) bool
- func (v Version) GreaterThan(o Version) bool
- func (v Version) GreaterThanOrEqual(o Version) bool
- func (v Version) LessThan(o Version) bool
- func (v Version) LessThanOrEqual(o Version) bool
- func (v Version) Original() string
- func (v Version) PessimisticBump() Version
- func (v Version) String() string
- func (v Version) TildeBump() Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection []Version
Collection is a type that implements the sort.Interface interface so that versions can be sorted.
func (Collection) Len ¶
func (v Collection) Len() int
func (Collection) Less ¶
func (v Collection) Less(i, j int) bool
func (Collection) Swap ¶
func (v Collection) Swap(i, j int)
type Constraint ¶
type Constraint struct {
// contains filtered or unexported fields
}
func (Constraint) Operator ¶
func (c Constraint) Operator() string
func (Constraint) String ¶
func (c Constraint) String() string
func (Constraint) Version ¶
func (c Constraint) Version() string
type Constraints ¶
type Constraints struct {
// contains filtered or unexported fields
}
Constraints is one or more constraint that a version can be checked against.
func NewConstraints ¶
func NewConstraints(v string) (Constraints, error)
NewConstraints parses a given constraint and returns a new instance of Constraints
func (Constraints) Check ¶
func (cs Constraints) Check(v Version) bool
Check tests if a version satisfies all the constraints.
func (Constraints) List ¶
func (cs Constraints) List() [][]Constraint
func (Constraints) String ¶
func (cs Constraints) String() string
Returns the string format of the constraints
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents a single version.
func (Version) CaretBump ¶
CaretBump returns the maximum version of "^" https://docs.npmjs.com/cli/v6/using-npm/semver#caret-ranges-123-025-004
func (Version) Compare ¶
Compare compares this version to another version. This returns -1, 0, or 1 if this version is smaller, equal, or larger than the other version, respectively.
func (Version) GreaterThan ¶
GreaterThan tests if this version is greater than another version.
func (Version) GreaterThanOrEqual ¶
GreaterThanOrEqual tests if this version is greater than or equal to another version.
func (Version) LessThanOrEqual ¶
LessThanOrEqual tests if this version is less than or equal to another version.
func (Version) Original ¶
Original returns the original parsed version as-is, including any potential whitespace, `v` prefix, etc.
func (Version) PessimisticBump ¶
PessimisticBump returns the maximum version of "~>" It works like Gem::Version.bump() https://docs.ruby-lang.org/en/2.6.0/Gem/Version.html#method-i-bump
func (Version) String ¶
String returns the full version string included pre-release and metadata information.
func (Version) TildeBump ¶
TildeBump returns the maximum version of "~" https://docs.npmjs.com/cli/v6/using-npm/semver#tilde-ranges-123-12-1