package version
import "github.com/cockroachdb/cockroach-go/v2/testserver/version"
Index ¶
- type Version
- func MustParse(str string) *Version
- func Parse(str string) (*Version, error)
- func (v *Version) AtLeast(w *Version) bool
- func (v *Version) Compare(w *Version) int
- func (v *Version) Major() int
- func (v *Version) Metadata() string
- func (v *Version) Minor() int
- func (v *Version) Patch() int
- func (v *Version) PreRelease() string
- func (v Version) String() string
Types ¶
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents a semantic version; see https://semver.org/spec/v2.0.0.html.
func MustParse ¶
MustParse is like Parse but panics on any error. Recommended as an initializer for global values.
func Parse ¶
Parse creates a version from a string. The string must be a valid semantic version (as per https://semver.org/spec/v2.0.0.html) in the format:
"vMINOR.MAJOR.PATCH[-PRERELEASE][+METADATA]".
MINOR, MAJOR, and PATCH are numeric values (without any leading 0s). PRERELEASE and METADATA can contain ASCII characters and digits, hyphens and dots.
func (*Version) AtLeast ¶
AtLeast returns true if v >= w.
func (*Version) Compare ¶
Compare returns -1, 0, or +1 indicating the relative ordering of versions.
func (*Version) Major ¶
Major returns the major (first) version number.
func (*Version) Metadata ¶
Metadata returns the metadata (if present).
func (*Version) Minor ¶
Minor returns the minor (second) version number.
func (*Version) Patch ¶
Patch returns the patch (third) version number.
func (*Version) PreRelease ¶
PreRelease returns the pre-release version (if present).
func (Version) String ¶
String returns the string representation, in the format:
"v1.2.3-beta+md"
Source Files ¶
- Version
- v2.4.0 (latest)
- Published
- Feb 5, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.