version

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraints

type Constraints interface {
	Check(v Version) bool
	String() string
}

func NewConstraint

func NewConstraint(v string) (Constraints, error)

type Version

type Version interface {
	// Compare compares this version to another version. This
	// returns -1, 0, or 1 if this version is smaller, equal,
	// or larger than the other version, respectively.
	Compare(other Version) int

	// Equal tests if two versions are equal.
	Equal(other Version) bool

	// Metadata returns any metadata that was part of the version
	// string.
	//
	// Metadata is anything that comes after the "+" in the version.
	// For example, with "1.2.3+beta", the metadata is "beta".
	Metadata() string

	// Prerelease returns any prerelease data that is part of the version,
	// or blank if there is no prerelease data.
	//
	// Prerelease information is anything that comes after the "-" in the
	// version (but before any metadata). For example, with "1.2.3-beta",
	// the prerelease information is "beta".
	Prerelease() string

	// Segments returns the numeric segments of the version as a slice of ints.
	Segments() []int

	// String returns the full version string included pre-release
	// and metadata information.
	String() string

	// Original returns the original parsed version as-is
	Original() string
}

func NewVersion

func NewVersion(v string) (Version, error)

Jump to

Keyboard shortcuts

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