Documentation
¶
Index ¶
Constants ¶
const RegexSemVer = "([0-9]+)\\.([0-9]+)\\.([0-9]+)[-_]?([a-zA-Z0-9\\.]*)\\+?([a-zA-Z0-9]+)?"
RegexSemVer represents version of SevVer format: major.minor.patch-<pre>+<build>
Variables ¶
This section is empty.
Functions ¶
func CheckMaxVersionRequirement ¶
CheckMaxVersionRequirement checks if a version meets the maximum version requirements
func CheckMinVersionRequirement ¶
CheckMinVersionRequirement checks if a version meets the minimum version requirements
Types ¶
type Semver ¶
type Semver struct {
// contains filtered or unexported fields
}
Semver represents a Semantic Version. It also exposes various version comparison functionalities.
It uses Semantic Versioning specification to handle the version comparison logic.
If a version is not SemVer formatted, it converts that into a SemVer format:
- "219" will be converted into 219.0.0 internally.
- "v1.2" will be converted to "1.2.0" internally.
- "8.30" will be converted to "8.30.0" internally.
preRelease part of the version is compared lexicographically for simplicity of implementation. The reason for such trade-off is we only expect proper released version of the software to be installed on the nodes. However, if there is a preRelease-release part in the version, it will be considered lower precedence if major, minor, and patch are equal, which adheres to spec https://semver.org/#spec-item-11. If both versions have preRelease-release part, preRelease parts are compared lexicographically.
func NewSemver ¶
NewSemver parses and returns an instance of Semver if parsing of the input version string is successful
func (*Semver) EqualTo ¶
EqualTo checks if it is equal to the input version It performs a string comparison of the raw in full.
func (*Semver) GreaterOrEqual ¶
GreaterOrEqual return true if it is greater than or equal to the input version v2 This is just a wrapper function around GreaterThan and EqualTo
func (*Semver) GreaterThan ¶
GreaterThan checks if it is greater than the input version v2 Ref: https://semver.org/#spec-item-11
func (*Semver) LessOrEqual ¶
LessOrEqual return true if it is less than or equal to the input version v2 This is just a wrapper function around LessThan and EqualTo
func (*Semver) LessThan ¶
LessThan checks if it is less than the input version v2 Ref: https://semver.org/#spec-item-11