semver

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMajor = ^uint(0)
	MaxMinor = ^uint(0)
	MaxPatch = ^uint(0)
)
View Source
const 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

This section is empty.

Functions

func IsValid

func IsValid(s string) bool

func Sort

func Sort(data []SemVer)

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 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) 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