semver

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package semver provides functionality to parse and process semantic versions, as they are used in multiple components of Constellation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Semver

type Semver struct {
	Major      int
	Minor      int
	Patch      int
	Prerelease string
}

Semver represents a semantic version.

func New added in v2.7.0

func New(version string) (Semver, error)

New returns a Version from a string.

func (Semver) Compare

func (v Semver) Compare(other Semver) int

Compare compares two versions. It relies on the semver.Compare function internally.

func (Semver) CompatibleWithBinary

func (v Semver) CompatibleWithBinary() bool

CompatibleWithBinary returns if a version is compatible version of the current built binary. It checks if the version of the binary is equal or greater than the current version and allows a drift of at most one minor version.

func (Semver) IsUpgradeTo

func (v Semver) IsUpgradeTo(other Semver) bool

IsUpgradeTo returns if a version is an upgrade to another version. It checks if the version of v is greater than the version of other and allows a drift of at most one minor version.

func (Semver) MajorMinorEqual added in v2.9.0

func (v Semver) MajorMinorEqual(other Semver) bool

MajorMinorEqual returns if the major and minor version of two versions are equal.

func (Semver) MarshalJSON

func (v Semver) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Semver) NextMinor

func (v Semver) NextMinor() string

NextMinor returns the next minor version in the format "vMAJOR.MINOR".

func (Semver) String

func (v Semver) String() string

String returns the string representation of the version.

func (*Semver) UnmarshalJSON

func (v *Semver) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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