versioning

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Range

type Range func(Version) bool

Range represents a range of versions which can be use to validate if a Version is valid for a Range.

func MustNewRange

func MustNewRange(rangeStr string) Range

MustNewRange creates a new instance of a Version; however it will panic if it cannot be created.

func NewRange

func NewRange(rangeStr string) (Range, error)

NewRange creates an instance of a Range. Valid ranges can consist of multiple comparisons and three/four digit versions:

  • "<1.0.0" || "<v1.0.0.0"
  • "<=1.0.0" || "<=1.0.0.0"
  • ">1.0.0" || ">1.0.0.0"
  • ">=1.0.0" || >= 1.0.0.0
  • "1.0.0", "=1.0.0", "==1.0.0" || "1.0.0.0", "=1.0.0.0", "==1.0.0.0"
  • "!1.0.0", "!=1.0.0" || "!1.0.0.0", "!=1.0.0.0"

A Range can consist of multiple ranges separated by space: Ranges can be linked by logical AND:

  • ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0"
  • ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2

Four digit versions can be used in ranges with three digit version and linked by logical AND:

  • ">1.0.0 <2.0.0.0" would match between both ranges, so "1.0.0.1" and "1.8.7" but not "1.0.0", "2.0.0"
  • ">1.0.0 <3.0.0 !2.0.3.0-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2 and 2.0.3.0-beta2

Ranges can also be linked by logical OR:

  • "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x"

Four digit versions can be used in ranges with three digit version and linked by logical OR:

AND has a higher precedence than OR. It's not possible to use brackets.

Ranges can be combined by both AND and OR:

  • ">1.0.0 <2.0.0.0 || >3.0.0 !4.2.1" would match "1.2.3", "1.0.0.1", "1.9.9", "3.1.1", but not "4.2.1", "2.1.1"

type Version

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

Version represents a three or four digit version.

func MustNewVersion

func MustNewVersion(versionStr string) Version

MustNewVersion creates a new instance of a Version; however it will panic if it cannot be created.

func NewVersion

func NewVersion(versionStr string) (Version, error)

NewVersion creates a new instance of a Version.

func (Version) Build

func (v Version) Build() string

Build returns the build metadata string of Version.

func (Version) IsKongGatewayEnterprise

func (v Version) IsKongGatewayEnterprise() bool

IsKongGatewayEnterprise determines if a Version represents a Kong Gateway enterprise edition.

func (Version) Major

func (v Version) Major() uint64

Major returns the major digit of Version.

func (Version) Minor

func (v Version) Minor() uint64

Minor returns the minor digit of Version.

func (Version) Patch

func (v Version) Patch() uint64

Patch returns the patch digit of Version.

func (Version) PreRelease

func (v Version) PreRelease() string

PreRelease returns the pre-release string of Version.

func (Version) Revision

func (v Version) Revision() (uint64, error)

Revision returns the revision digit of Version; if revision has not been set then an error will be returned.

func (Version) String

func (v Version) String() string

String returns the textual or display value of the Version.

Jump to

Keyboard shortcuts

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