semver

package
v0.0.0-...-fce26ca Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SEMVERRE = `(\d+)\.(\d+)\.(\d+)`

SEMVERRE is the semantic versioning regexp

View Source
const SEMVERRE_PRE_RE = `(.*)` + SEMVERRE
View Source
const SEMVERRE_SUF_RE = SEMVERRE + `(.*)`

Variables

View Source
var ErrParsingError = errors.New("parsing error")

Functions

func MaxLabel

func MaxLabel(a, b string) string

Types

type ByVersionDescending

type ByVersionDescending []SemVer

ByVersionDescending sorts versions in descending order. Suffixes are parsed according to semver

func (ByVersionDescending) Len

func (a ByVersionDescending) Len() int

func (ByVersionDescending) Less

func (a ByVersionDescending) Less(i, j int) bool

func (ByVersionDescending) Swap

func (a ByVersionDescending) Swap(i, j int)

type SemVer

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

SemVer is a struct representing a semantic version

func Max

func Max(a, b SemVer) SemVer

func MaxSlice

func MaxSlice(v []SemVer) SemVer

MaxSlice returns the highest version in a list

func Parse

func Parse(s string) (SemVer, error)

Parse returns a new SemVer, or an error is a parsing error occurs

func ParseSeparated

func ParseSeparated(s, prefixSeparator, suffixSeparator string) (SemVer, error)

func (*SemVer) IncrementMajor

func (s *SemVer) IncrementMajor()

IncrementMajor increments the major version and sets minor and patch to zero

func (*SemVer) IncrementMinor

func (s *SemVer) IncrementMinor()

IncrementMinor increments the minor version and sets patch to zero

func (*SemVer) IncrementPatch

func (s *SemVer) IncrementPatch()

IncrementPatch increments the patch version

func (SemVer) PreSuffix

func (s SemVer) PreSuffix() (string, string)

PreSuffix returns the prefix and suffix of s

func (*SemVer) Prefix

func (s *SemVer) Prefix(prefix string)

func (*SemVer) Presep

func (s *SemVer) Presep(pre string)

func (SemVer) String

func (s SemVer) String() string

String returns the complete string semantic version

func (*SemVer) Suffix

func (s *SemVer) Suffix(suffix string)

func (*SemVer) Sufsep

func (s *SemVer) Sufsep(suf string)

func (SemVer) Version

func (s SemVer) Version() string

Version returns the semantic version, without any prefixes or suffixes

Jump to

Keyboard shortcuts

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