versions

package
v0.0.5-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: AGPL-3.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidVersionParts = errors.New("invalid version parts")
	ErrInvalidPreRelease   = errors.New("invalid pre release")
	ErrInvalidMetaData     = errors.New("invalid meta data")
)

Functions

func GetMetaDataPart

func GetMetaDataPart(versionLiteral string) string

func GetPreReleasePart

func GetPreReleasePart(versionLiteral string) string

func GetVersionPart

func GetVersionPart(versionLiteral string) string

func IsPartialVersion

func IsPartialVersion(versionLiteral string) bool

func IsStaticVersion

func IsStaticVersion(versionLiteral string) bool

func IsWildCardVersion

func IsWildCardVersion(versionLiteral string) bool

Types

type Semver

type Semver struct {
	Major         int
	Minor         int
	Patch         int
	PreReleaseTag string
	MetaData      string
}

func ParseSemver

func ParseSemver(versionLiteral string) (Semver, error)

Parses a semver string into a semver object

func (Semver) Compare

func (v1 Semver) Compare(v2 Semver, ignorePreRelease bool) int

Compares versions v1 and v2, and returns 0 if v1 = v2, returns 1 if v1 > v2 and 0 otherwise This comparision is done according to the semver 2.0 spec

func (Semver) EQ

func (v1 Semver) EQ(v2 Semver, ignorePreRelease bool) bool

Compares versions v1 and v2, and returns true if v1 = v2 and false otherwise This comparision is done according to the semver 2.0 spec

func (Semver) GE

func (v1 Semver) GE(v2 Semver, ignorePreRelease bool) bool

Compares versions v1 and v2, and returns true if v1 >= v2 and false otherwise This comparision is done according to the semver 2.0 spec

func (Semver) GT

func (v1 Semver) GT(v2 Semver, ignorePreRelease bool) bool

Compares versions v1 and v2, and returns true if v1 > v2 and false otherwise This comparision is done according to the semver 2.0 spec

func (Semver) LE

func (v1 Semver) LE(v2 Semver, ignorePreRelease bool) bool

Compares versions v1 and v2, and returns true if v1 <= v2 and false otherwise This comparision is done according to the semver 2.0 spec

func (Semver) LT

func (v1 Semver) LT(v2 Semver, ignorePreRelease bool) bool

Compares versions v1 and v2, and returns true if v1 < v2 and false otherwise This comparision is done according to the semver 2.0 spec

func (Semver) NEQ

func (v1 Semver) NEQ(v2 Semver, includePreReleases bool) bool

Compares versions v1 and v2, and returns true if v1 != v2 and false otherwise This comparision is done according to the semver 2.0 spec

func (Semver) String

func (v Semver) String() string

Returns a string representation of the parsed semver Note: the metadata and prerelease info might not be in the same order as the original string that was parsed

Jump to

Keyboard shortcuts

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