Documentation ¶
Index ¶
Constants ¶
const ( // ParseModeStrict is the default parsing mode, requiring a strictly correct version string with // all three required numeric components. ParseModeStrict = iota // ParseModeAllowMissingMinorAndPatch is a parsing mode in which the version string may omit the patch // version component ("2.1"), or both the minor and patch version components ("2"), in which case // they are assumed to be zero. ParseModeAllowMissingMinorAndPatch = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version is a semantic version as defined by the Semantic Versions 2.0.0 standard (http://semver.org).
This type provides only parsing and simple precedence comparison, since those are the only features required by the LaunchDarkly Go SDK.
func Parse ¶
Parse attempts to parse a string into a Version. It only accepts strings that strictly match the specification, so extensions like a "v" prefix are not allowed.
If parsing fails, it returns a non-nil error as the second return value, and Version{} as the first.
func ParseAs ¶
ParseAs attempts to parse a string into a Version, using the specified ParseMode.
If parsing fails, it returns a non-nil error as the second return value, and Version{} as the first.
func (Version) ComparePrecedence ¶
ComparePrecedence compares this Version to another Version according to the canonical precedence rules. It returns -1 if v has lower precedence than other, 1 if v has higher precedence, or 0 if the same.
func (Version) GetPrerelease ¶
GetPrerelease returns the prerelease version component, or "" if there is none.