version

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 4 Imported by: 69

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type V

type V struct {
	Major  int
	Minor  int
	Bugfix int
	Meta   string
	// contains filtered or unexported fields
}

func MustNew

func MustNew(version string) *V

MustNew creates a version from the given version string. If the version string is invalid, MustNew panics.

func New

func New(version string) (*V, error)

New expects a string in the format: major.minor.bugfix(-meta)

func (*V) IsMajor

func (v *V) IsMajor(major int) bool

func (*V) IsValid

func (v *V) IsValid() bool

IsValid returns true if the version object stores a successfully parsed version number.

func (*V) LessThan

func (v *V) LessThan(v1 *V) bool

LessThan returns true if v is strictly smaller than v1. When comparing, the major, minor and bugfix numbers are compared in order. The meta part is not taken into account.

func (*V) LessThanMajorMinor

func (v *V) LessThanMajorMinor(v1 *V) bool

LessThanMajorMinor returns true if v is smaller or equal to v1 based on the major and minor version. The bugfix version and meta part are not taken into account. minor numbers are compared in order. The and bugfix version and meta part is not taken into account.

func (*V) LessThanOrEqual

func (v *V) LessThanOrEqual(withMeta bool, v1 *V) bool

LessThan returns true if v is strictly smaller than v1. When comparing, the major, minor, bugfix and pre-release numbers are compared in order.

func (*V) String

func (v *V) String() string

func (*V) UnmarshalJSON

func (v *V) UnmarshalJSON(version []byte) error

UnmarshalJSON unmarshals a JSON string version representation into a Version struct Implements https://golang.org/pkg/encoding/json/#Unmarshaler

Jump to

Keyboard shortcuts

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