semver

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package semver implements basic semantic versions using the vX.Y.Z format. It supports parsing and sorting of versions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort

func Sort(versions []Version)

Sort sorts a slice of versions

Types

type Version

type Version semver.Version

func MustParse

func MustParse(v string) Version

MustParse is like Parse but panics if the version cannot be parsed.

func Parse

func Parse(v string) (Version, error)

Parse parses version string in vX.Y.Z format and returns a validated Version or error.

func (Version) LessThan

func (ver Version) LessThan(other Version) bool

func (Version) String

func (ver Version) String() string

String returns display representation of the version in the vX.Y.Z format.

type Versions

type Versions []Version

Versions represents multiple versions.

func (Versions) Len

func (s Versions) Len() int

Len returns length of version collection

func (Versions) Less

func (s Versions) Less(i, j int) bool

Less checks if version at index i is less than version at index j

func (Versions) Swap

func (s Versions) Swap(i, j int)

Swap swaps two versions inside the collection by its indices

Jump to

Keyboard shortcuts

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