cockroach: github.com/cockroachdb/cockroach/pkg/util/version Index | Files

package version

import "github.com/cockroachdb/cockroach/pkg/util/version"

Index

Package Files

version.go

type Version Uses

type Version struct {
    // contains filtered or unexported fields
}

Version represents a semantic version; see https://semver.org/spec/v2.0.0.html.

func MustParse Uses

func MustParse(str string) *Version

MustParse is like Parse but panics on any error. Recommended as an initializer for global values.

func Parse Uses

func Parse(str string) (*Version, error)

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 Uses

func (v *Version) AtLeast(w *Version) bool

AtLeast returns true if v >= w.

func (*Version) Compare Uses

func (v *Version) Compare(w *Version) int

Compare returns -1, 0, or +1 indicating the relative ordering of versions.

func (*Version) Major Uses

func (v *Version) Major() int

Major returns the major (first) version number.

func (*Version) Metadata Uses

func (v *Version) Metadata() string

Metadata returns the metadata (if present).

func (*Version) Minor Uses

func (v *Version) Minor() int

Minor returns the minor (second) version number.

func (*Version) Patch Uses

func (v *Version) Patch() int

Patch returns the patch (third) version number.

func (*Version) PreRelease Uses

func (v *Version) PreRelease() string

PreRelease returns the pre-release version (if present).

func (Version) String Uses

func (v Version) String() string

String returns the string representation, in the format:

"v1.2.3-beta+md"

Package version imports 5 packages (graph) and is imported by 8 packages. Updated 2019-08-17. Refresh now. Tools for package owners.