Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidVersion = Error{Message: "invalid version %q"}
)
Version error.
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
type Constraint struct { Gt *Version // Greater than... Gte *Version // Greater than or equal to... Lt *Version // Less than... Lte *Version // Less than or equal to... }
Constraint enables matching a version based on lower and upper bounds.
type List ¶
type List []*Version
List is a slice of versions that implements sort.Interface.
func (List) Match ¶
func (list List) Match(c *Constraint) List
Match tests versions against a constraint and returns a new List of matching versions only.
type Version ¶
type Version struct { Major int // Major version number. Minor int // Minor version number. Patch int // Patch version number. Extension string // Version extension, such as pre-release number or build metdata. Text string // Original version string, if this version was created via the Parse function. }
Version is a structured representation of a version number.
func (*Version) Compare ¶
Compare this version (a) with another version (b). This function returns -1 if a is less than b, 1 if a is greater than b, or 0 if a is equal to b.
Extensions such as pre-release version or build metadata are ignored when comparing versions.
func (*Version) Equal ¶
Equal checks for equality between two versions.
Extensions such as pre-release version or build metadata are ignored when comparing versions.
func (*Version) Less ¶
Less performs a simple comparison of this version (a) with another version (b). This function returns true if a is less than b, or false otherwise.
Extensions such as pre-release version or build metadata are ignored when comparing versions.
func (*Version) Match ¶
func (v *Version) Match(c *Constraint) bool
Match tests the version against a constraint. Gt and Lt take precedence over Gte and Lte.
func (*Version) SemanticString ¶
SemanticString returns a version string conforming to the standard described in Semantic Versioning 2.0.0.