Documentation ¶
Overview ¶
The Tideland Go Library version package helps other packages to provide information about their current version and compare it to others. It follows the idea of semantic versioning (see http://semver.org/).
Version instances can be created via New() with explicit passed field values or via Parse() and a passed sting. Beside accessing the individual fields two versions can be compared with Compare() and Less().
Index ¶
Constants ¶
View Source
const ( Metadata = "+" Newer Precedence = 1 Equal = 0 Older = -1 Major Level = "major" Minor = "minor" Patch = "patch" PreRelease = "pre-release" All = "all" )
View Source
const (
ErrIllegalVersionFormat = iota + 1
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level string
Level describes the level, on which a version differentiates from an other.
type Version ¶
type Version interface { fmt.Stringer // Major returns the major version. Major() int // Minor returns the minor version. Minor() int // Patch return the path version. Patch() int // PreRelease returns a possible pre-release of the version. PreRelease() string // Metadata returns a possible build metadata of the version. Metadata() string // Compare compares this version to the passed one. The result // is from the perspective of this one. Compare(cv Version) (Precedence, Level) // Less returns true if this version is less than the passed one. // This means this version is older. Less(cv Version) bool }
Version defines the interface of a version.
Click to show internal directories.
Click to hide internal directories.