es_version

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidVersionFormat = errors.New("invalid version format")
)

Functions

func Compare

func Compare(x, y Version) int

Compare x, y as semantic version number. The result will be 0 if x==y, -1 if x < y, and +1 if x > y.

Types

type Version

type Version struct {
	Major      uint64 `json:"major"`
	Minor      uint64 `json:"minor"`
	Patch      uint64 `json:"patch"`
	PreRelease string `json:"pre_release"`
	Build      string `json:"build"`
}

func Max

func Max(versions ...Version) Version

Max selects maximum version in versions. Returns 0.0.0 if len(versions) == 0.

func Min

func Min(versions ...Version) Version

Min selects minimum version in versions. Returns 0.0.0 if len(versions) == 0.

func MustParse

func MustParse(v string) Version

func Parse

func Parse(v string) (version Version, err error)

Parse version string as semantic versioning system MAJOR.MINOR.PATCH Return 0.0.0 for version and an error if the invalid format.

func Zero

func Zero() Version

Zero returns "0.0.0"

func (Version) Compare

func (z Version) Compare(x Version) int

func (Version) Equals

func (z Version) Equals(x Version) bool

func (Version) String

func (z Version) String() string

Jump to

Keyboard shortcuts

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