semver

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMajor           = ^uint(0)
	MaxMinor           = ^uint(0)
	MaxPatch           = ^uint(0)
	NamedGroupsPattern = `^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)` +
		`(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` +
		`(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`
)

Variables

View Source
var (
	ErrNextMajorUintOverflow = errors.New("next major version overflows uint")
	ErrNextMinorUintOverflow = errors.New("next minor version overflows uint")
	ErrNextPatchUintOverflow = errors.New("next patch version overflows uint")
)

Functions

func IsValid

func IsValid(s string) bool

Types

type Builder

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

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Build

func (b *Builder) Build() (*SemVer, bool)

func (*Builder) BuildMetadata

func (b *Builder) BuildMetadata(buildMetadata []string) *Builder

func (*Builder) BuildMetadataField

func (b *Builder) BuildMetadataField(buildMetadata string) *Builder

func (*Builder) Major

func (b *Builder) Major(major uint) *Builder

func (*Builder) Minor

func (b *Builder) Minor(minor uint) *Builder

func (*Builder) Patch

func (b *Builder) Patch(patch uint) *Builder

func (*Builder) PreRelease

func (b *Builder) PreRelease(preRelease []string) *Builder

func (*Builder) PreReleaseField

func (b *Builder) PreReleaseField(preRelease string) *Builder

type BySemVer

type BySemVer []SemVer

func (BySemVer) Len

func (s BySemVer) Len() int

func (BySemVer) Less

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

func (BySemVer) Swap

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

type InvalidSemVerError added in v2.3.0

type InvalidSemVerError string

func (InvalidSemVerError) Error added in v2.3.0

func (s InvalidSemVerError) Error() string

type SemVer

type SemVer struct {
	Major         uint     `json:"major"`
	Minor         uint     `json:"minor"`
	Patch         uint     `json:"patch"`
	PreRelease    []string `json:"preRelease"`
	BuildMetadata []string `json:"buildMetadata"`
}

func MustParse

func MustParse(s string) *SemVer

func Parse

func Parse(s string) (*SemVer, error)

func (*SemVer) BuildMetadataString

func (s *SemVer) BuildMetadataString() string

func (*SemVer) CompareTo

func (s *SemVer) CompareTo(o SemVer) int

func (*SemVer) Equal

func (s *SemVer) Equal(o SemVer) bool

func (*SemVer) HasBuildMetadata

func (s *SemVer) HasBuildMetadata() bool

func (*SemVer) HasNoBuildMetadata

func (s *SemVer) HasNoBuildMetadata() bool

func (*SemVer) IsNotPreRelease

func (s *SemVer) IsNotPreRelease() bool

func (*SemVer) IsPreRelease

func (s *SemVer) IsPreRelease() bool

func (*SemVer) IsRelease

func (s *SemVer) IsRelease() bool

func (*SemVer) IsValid

func (s *SemVer) IsValid() bool

func (*SemVer) NextMajor

func (s *SemVer) NextMajor() *SemVer

func (*SemVer) NextMinor

func (s *SemVer) NextMinor() *SemVer

func (*SemVer) NextPatch

func (s *SemVer) NextPatch() *SemVer

func (*SemVer) PreReleaseString

func (s *SemVer) PreReleaseString() string

func (*SemVer) SetBuildMetadata

func (s *SemVer) SetBuildMetadata(buildMetadata []string)

func (*SemVer) SetMajor

func (s *SemVer) SetMajor(major uint)

func (*SemVer) SetMinor

func (s *SemVer) SetMinor(minor uint)

func (*SemVer) SetPatch

func (s *SemVer) SetPatch(patch uint)

func (*SemVer) SetPreRelease

func (s *SemVer) SetPreRelease(preRelease []string)

func (*SemVer) String

func (s *SemVer) String() string

Jump to

Keyboard shortcuts

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