Documentation ¶
Overview ¶
Copyright (C) 2023 by Posit Software, PBC
Copyright (C) 2023 by Posit Software, PBC
Index ¶
- Variables
- func CompareManifestVersions(a, b ManifestVersion) int
- func CompareSchemaMajor(a, b ManifestVersion) int
- func CompareVersions(a, b RVersion) int
- type ManifestVersion
- func (v ManifestVersion) Equals(other ManifestVersion) bool
- func (v ManifestVersion) EqualsMajor(other ManifestVersion) bool
- func (v ManifestVersion) GreaterThan(other ManifestVersion) bool
- func (v ManifestVersion) LessThan(other ManifestVersion) bool
- func (v ManifestVersion) LessThanMajor(other ManifestVersion) bool
- func (v ManifestVersion) LessThanOrEqual(other ManifestVersion) bool
- func (v ManifestVersion) MarshalJSON() ([]byte, error)
- func (v *ManifestVersion) Parse() error
- func (v ManifestVersion) String() string
- func (v *ManifestVersion) UnmarshalJSON(data []byte) error
- type RVersion
- func (v RVersion) Equals(other RVersion) bool
- func (v RVersion) GreaterThan(other RVersion) bool
- func (v RVersion) LessThan(other RVersion) bool
- func (v RVersion) MarshalJSON() ([]byte, error)
- func (v *RVersion) Parse() error
- func (v RVersion) String() string
- func (v *RVersion) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
var ManifestVersionSeparators = []rune{'/', '.'}
ManifestVersionSeparators are valid separators for versions. For example, these are all valid versions:
`1.2.3.4` `1-2-3` `1-2.3-4.5`
Functions ¶
func CompareManifestVersions ¶
func CompareManifestVersions(a, b ManifestVersion) int
CompareManifestVersions compares the numerical components of two versions.
returns:
-1 if a < b 0 if a == b 1 if a > b
func CompareSchemaMajor ¶
func CompareSchemaMajor(a, b ManifestVersion) int
CompareSchemaMajor compares schema, major (NOT minor) of two versions.
returns:
-1 iff a < b 0 iff a == b 1 iff a > b
The schema and major version are sorted numerically.
func CompareVersions ¶
CompareVersions compares the numerical components of two versions.
returns:
-1 if a < b 0 if a == b 1 if a > b
Types ¶
type ManifestVersion ¶
ManifestVersion represents semantic version information with each component as an int. Other types of version strings are not supported.
func NewManifestVersion ¶
func NewManifestVersion(schema, major, minor int) ManifestVersion
func ParseNewManifestVersion ¶
func ParseNewManifestVersion(s string) (ManifestVersion, error)
ParseNewManifestVersion creates a ManifestVersion from a string.
func (ManifestVersion) Equals ¶
func (v ManifestVersion) Equals(other ManifestVersion) bool
Equals tests that this version is equivalent to another.
func (ManifestVersion) EqualsMajor ¶
func (v ManifestVersion) EqualsMajor(other ManifestVersion) bool
EqualsMajor tests that this version is equivalent to another in major version.
func (ManifestVersion) GreaterThan ¶
func (v ManifestVersion) GreaterThan(other ManifestVersion) bool
GreaterThan tests that this version is greater than another.
func (ManifestVersion) LessThan ¶
func (v ManifestVersion) LessThan(other ManifestVersion) bool
LessThan tests that this version is greater than another.
func (ManifestVersion) LessThanMajor ¶
func (v ManifestVersion) LessThanMajor(other ManifestVersion) bool
LessThanMajor tests that this version is greater in schema/major version than another
func (ManifestVersion) LessThanOrEqual ¶
func (v ManifestVersion) LessThanOrEqual(other ManifestVersion) bool
LessThanOrEqual tests that this version is less than or equal to another.
func (ManifestVersion) MarshalJSON ¶
func (v ManifestVersion) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the JSON marshalling interface.
func (*ManifestVersion) Parse ¶
func (v *ManifestVersion) Parse() error
Parse version information from a string. Supports the following formats:
- W.X - W.X.Y - W.X.Y.Z - W.X.Y-Z (last components may be separated by a hyphens)
Each component must be integral.
func (ManifestVersion) String ¶
func (v ManifestVersion) String() string
String generates a string representation of the version.
func (*ManifestVersion) UnmarshalJSON ¶
func (v *ManifestVersion) UnmarshalJSON(data []byte) error
UnmarshalJSON satisfies the JSON unmarshalling interface.
type RVersion ¶
type RVersion struct { Raw string Major int Minor int Patch int Rev int Parts []int Set bool Err error }
RVersion represents semantic version information with each component as an int. Other types of version strings are not supported.
func ParseNewVersion ¶
ParseNewVersion creates a RVersion from a string.
func (RVersion) GreaterThan ¶
GreaterThan tests that this version is greater than another.
func (RVersion) MarshalJSON ¶
MarshalJSON satisfies the JSON marshalling interface.
func (*RVersion) Parse ¶
Parse version information from a string. Supports the following formats:
- W.X - W.X.Y - W.X.Y.Z - W.X.Y-Z (last components may be separated by a hyphens)
Each component must be integral.
func (*RVersion) UnmarshalJSON ¶
UnmarshalJSON satisfies the JSON unmarshalling interface.