version

package
v2.17.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnknownVersion = Version{}

UnknownVersion is just a version that is not set

Functions

This section is empty.

Types

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a software version composed of

func GetLatestVersion added in v2.9.2

func GetLatestVersion(ctx context.Context, client *http.Client, url string) (Version, error)

func ParseVersion

func ParseVersion(versionString string) (Version, error)

ParseVersion takes a version as string and tries to parse it to convert it to a Version value. It returns the Version value and possibly an error if the string could not be parsed. Expected formats are "MAJOR", "MAJOR.MINOR" or "MAJOR.MINOR.PATCH" with each component being a non-negative number. Omitted minor or patch versions are interpreted as 0, so "2" is interpreted as 2.0.0 and "2.1" is interpreted as 2.1.0.

func (Version) GreaterThan

func (v Version) GreaterThan(other Version) bool

GreaterThan determines whether this version is greater than the other version

func (Version) Invalid

func (v Version) Invalid() bool

Invalid returns whether this version is valid or not. A version is considered to be "invalid" if it is equal to "0.0.0" or contains a negative number, e.e. "0.-1.2"

func (Version) SmallerThan

func (v Version) SmallerThan(other Version) bool

SmallerThan determines whether this version is smaller than the given version

func (Version) String

func (v Version) String() string

String returns the version in a printable format, e.g.: 1.2.3

Jump to

Keyboard shortcuts

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