versions

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package version provides version related functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compatible

func Compatible(v1, v2 Version) bool

Compatible returns true if the two versions are compatible.

func Equal

func Equal(v1, v2 Version) bool

Equal returns true if the two versions are equal.

func GreaterThan

func GreaterThan(v1, v2 Version) bool

GreaterThan returns true if the first version is greater than the second version.

func GreaterThanOrEqual

func GreaterThanOrEqual(v1, v2 Version) bool

GreaterThanOrEqual returns true if the first version is greater than or equal to the second version.

func IsValidVersionString

func IsValidVersionString(versionString string) bool

IsValidVersionString returns true if the version string is valid.

func LessThan

func LessThan(v1, v2 Version) bool

LessThan returns true if the first version is less than the second version.

func LessThanOrEqual

func LessThanOrEqual(v1, v2 Version) bool

LessThanOrEqual returns true if the first version is less than or equal to the second version.

Types

type Version

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

Version is a version number. The version number is split into three parts: the major version, the minor version, and the patch version. The major version is incremented when a backwards incompatible change is made. The minor version is incremented when a backwards compatible change is made. The patch version is incremented when a bug fix is made. The version number is also split into a pre-release version and a stable version. The pre-release version is incremented when a pre-release version is made. The pre-release version is only used for pre-release versions. The stable version is only used for stable versions. The pre-release version is only used when the version is not a stable version.

func New

func New(
	major int, minor int, patch int,
	preReleaseName string, preReleaseNumber int) (Version, error)

New creates a new version. If the version is stable, the pre-release name should be empty and the pre-release number should -1.

func NewFromString

func NewFromString(versionString string) (Version, error)

NewFromString creates a new version from a version string.

func (Version) IsStable

func (v Version) IsStable() bool

func (Version) Major

func (v Version) Major() int

Major returns the major version.

func (Version) Minor

func (v Version) Minor() int

Minor returns the minor version.

func (Version) Patch

func (v Version) Patch() int

Patch returns the patch version.

func (Version) PreReleaseName

func (v Version) PreReleaseName() string

PreReleaseName returns the pre-release name.

func (Version) PreReleaseNumber

func (v Version) PreReleaseNumber() int

PreReleaseNumber returns the pre-release number.

func (Version) String

func (v Version) String() string

String returns the string representation of the version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL