semver

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SemVer

type SemVer struct {
	Major      uint
	Minor      uint
	Patch      uint
	Prerelease []string
	Metadata   []string
}

SemVer represents a semantic versioning

func Parse

func Parse(semver string) (SemVer, bool)

Parse reads a semantic version string and returns a SemVer. If the second return value is false, it implies that the input semver was incorrect.

func (*SemVer) AddMetadata added in v0.5.0

func (v *SemVer) AddMetadata(s ...string)

AddMetadata adds a new metadata identifier to the current semantic version. This is a shortcut for v.Metadata = append(v.Metadata, s...).

func (*SemVer) AddPrerelease added in v0.5.0

func (v *SemVer) AddPrerelease(s ...string)

AddPrerelease adds a new pre-release identifier to the current semantic version. This is a shortcut for v.Prerelease = append(v.Prerelease, s...).

func (SemVer) Next added in v0.5.0

func (v SemVer) Next() SemVer

Next returns the next patch version.

func (SemVer) Release

func (v SemVer) Release(version Version) SemVer

Release returns the semantic version for a release

func (SemVer) String added in v0.5.0

func (v SemVer) String() string

String returns a semantic version string (also implements fmt.Stringer).

type Version added in v0.5.0

type Version int

Version is either patch, minor, or major.

const (
	// Patch is the patch number in a semantic version.
	Patch Version = iota
	// Minor is the minor number in a semantic version.
	Minor
	// Major is the major number in a semantic version.
	Major
)

Jump to

Keyboard shortcuts

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