version

package
v0.0.0-...-1951e80 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection []Version

Collection is a type that implements the sort.Interface interface so that versions can be sorted.

func (Collection) Len

func (v Collection) Len() int

func (Collection) Less

func (v Collection) Less(i, j int) bool

func (Collection) Swap

func (v Collection) Swap(i, j int)

type Constraint

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

func (Constraint) Operator

func (c Constraint) Operator() string

func (Constraint) String

func (c Constraint) String() string

func (Constraint) Version

func (c Constraint) Version() string

type Constraints

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

Constraints is one or more constraint that a version can be checked against.

func NewConstraints

func NewConstraints(v string) (Constraints, error)

NewConstraints parses a given constraint and returns a new instance of Constraints

func (Constraints) Check

func (cs Constraints) Check(v Version) bool

Check tests if a version satisfies all the constraints.

func (Constraints) List

func (cs Constraints) List() [][]Constraint

func (Constraints) String

func (cs Constraints) String() string

Returns the string format of the constraints

type Version

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

Version represents a single version.

func Parse

func Parse(v string) (Version, error)

Parse parses the given version and returns a new Version.

func (Version) CaretBump

func (v Version) CaretBump() Version

CaretBump returns the maximum version of "^" https://docs.npmjs.com/cli/v6/using-npm/semver#caret-ranges-123-025-004

func (Version) Compare

func (v Version) Compare(other Version) int

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.

func (Version) Equal

func (v Version) Equal(o Version) bool

Equal tests if two versions are equal.

func (Version) GreaterThan

func (v Version) GreaterThan(o Version) bool

GreaterThan tests if this version is greater than another version.

func (Version) GreaterThanOrEqual

func (v Version) GreaterThanOrEqual(o Version) bool

GreaterThanOrEqual tests if this version is greater than or equal to another version.

func (Version) LessThan

func (v Version) LessThan(o Version) bool

LessThan tests if this version is less than another version.

func (Version) LessThanOrEqual

func (v Version) LessThanOrEqual(o Version) bool

LessThanOrEqual tests if this version is less than or equal to another version.

func (Version) Original

func (v Version) Original() string

Original returns the original parsed version as-is, including any potential whitespace, `v` prefix, etc.

func (Version) PessimisticBump

func (v Version) PessimisticBump() Version

PessimisticBump returns the maximum version of "~>" It works like Gem::Version.bump() https://docs.ruby-lang.org/en/2.6.0/Gem/Version.html#method-i-bump

func (Version) String

func (v Version) String() string

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

func (Version) TildeBump

func (v Version) TildeBump() Version

TildeBump returns the maximum version of "~" https://docs.npmjs.com/cli/v6/using-npm/semver#tilde-ranges-123-12-1

Jump to

Keyboard shortcuts

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