Documentation ¶
Index ¶
Constants ¶
const ( // RegexpWithCaptureGroup is a string regular expression that // also captures the capture groups [ // Prefix, // Major, // Minor, // Patch, // PreRelease, // BuildMetadata, // ]. this expression is a modified form from https://semver.org RegexpWithCaptureGroup = `` /* 258-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BuildMetadata ¶
type BuildMetadata []string
BuildMetadata stores the `build-metadata` section of a semantic version that's appended after a plus sign ('+')
func (BuildMetadata) String ¶
func (bm BuildMetadata) String() string
String returns a string representation of the build metadata
type PreRelease ¶
type PreRelease []string
PreRelease defines the pre-release label often appended after a hypen ('-') in a semantic version
func (PreRelease) String ¶
func (pr PreRelease) String() string
String returns the string representation of the pre- release label
type PreReleases ¶
type PreReleases []PreRelease
PreReleases is a sortable slice of PreRelease structures
func (PreReleases) Less ¶
func (prs PreReleases) Less(i, j int) bool
Less implements sort.Interface's Less()
func (PreReleases) Swap ¶
func (prs PreReleases) Swap(i, j int)
Swap implements sort.Interface's Swap()
type Semver ¶
type Semver struct { Prefix string `json:"prefix"` VersionCore VersionCore `json:"version_core"` PreRelease PreRelease `json:"pre_release"` BuildMetadata BuildMetadata `json:"build_metadata"` }
Semver stores information about a semantic version as defined at https://semver.org
func Parse ¶
Parse receives a string and returns a Semver instance that represents the semantic version
func (*Semver) BumpPreRelease ¶
BumpPreRelease bumps the pre-release version if applicable, if pre-release does not have a numerical version, returns an error
func (*Semver) SetBuildMetadata ¶
SetBuildMetadata sets the build-metadata section of the semantic version
func (*Semver) SetPreRelease ¶
SetPreRelease sets the pre-release section of the semantic version
type Semvers ¶
type Semvers []*Semver
Semvers is a slice of Semver structures with sorting capabilities
type VersionCore ¶
type VersionCore struct { Major uint `json:"major"` Minor uint `json:"minor"` Patch uint `json:"patch"` }
VersionCore represents the major, minor, and patch versions section of a semantic version
func (VersionCore) String ¶
func (vc VersionCore) String() string
String returns the string representation of the VersionCore structure
type VersionCores ¶
type VersionCores []VersionCore
VersionCores is a sortable slice of VersionCore structures
func (VersionCores) Less ¶
func (vcs VersionCores) Less(i, j int) bool
Less implements sort.Interface's Less()
func (VersionCores) Swap ¶
func (vcs VersionCores) Swap(i, j int)
Swap implements sort.Interface's Swap()