Documentation ¶
Index ¶
- func All(v Version) bool
- func MakeEqualsFull(this Version) func(other Version) bool
- func MakeEqualsMajor(this Version) func(other Version) bool
- func MakeEqualsMajorMinor(this Version) func(other Version) bool
- func MakeGTE(this Version) func(other Version) bool
- func MakeLTE(this Version) func(other Version) bool
- func None(v Version) bool
- type Range
- type Version
- func (v Version) Compare(o Version) int
- func (v Version) EQ(o Version) bool
- func (v Version) Equals(o Version) bool
- func (v Version) GE(o Version) bool
- func (v Version) GT(o Version) bool
- func (v Version) GTE(o Version) bool
- func (v Version) LE(o Version) bool
- func (v Version) LT(o Version) bool
- func (v Version) LTE(o Version) bool
- func (v Version) NE(o Version) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeEqualsFull ¶
func MakeEqualsMajor ¶
func MakeEqualsMajorMinor ¶
Types ¶
type Range ¶
Range represents a range of versions. A Range can be used to check if a Version satisfies it:
range, err := semver.ParseRange(">1.0.0 <2.0.0") range(semver.MustParse("1.1.1") // returns true
func MustParseRange ¶
MustParseRange is like ParseRange but panics if the range cannot be parsed.
func ParseRange ¶
ParseRange parses a range and returns a Range. If the range could not be parsed an error is returned.
Valid ranges are:
- "<1.0.0"
- "<=1.0.0"
- ">1.0.0"
- ">=1.0.0"
- "1.0.0", "=1.0.0", "==1.0.0"
- "!1.0.0", "!=1.0.0"
A Range can consist of multiple ranges separated by space: Ranges can be linked by logical AND:
- ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0"
- ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2
Ranges can also be linked by logical OR:
- "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x"
AND has a higher precedence than OR. It's not possible to use brackets.
Ranges can be combined by both AND and OR
- `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1`
type Version ¶
func (Version) Compare ¶
Compare compares Versions v to o: -1 == v is less than o 0 == v is equal to o 1 == v is greater than o
Click to show internal directories.
Click to hide internal directories.