Documentation
¶
Index ¶
- type Version
- func (v Version) BaseVersion() Version
- func (v Version) Bump(changeType string) (Version, error)
- func (v Version) Compare(other Version) int
- func (v Version) IsPreRelease() bool
- func (v Version) String() string
- func (v Version) WithBuildMetadata(metadata string) Version
- func (v Version) WithPreRelease(preRelease string) Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Version ¶
Version represents a semantic version with major, minor, and patch numbers, an optional pre-release identifier (e.g., "alpha.1", "beta.2", "snapshot.20260204-153045"), and optional build metadata (e.g., "build.123").
func MustParse ¶
MustParse parses a version string and panics if it fails Use only in tests or when the version string is known to be valid
func Parse ¶
Parse parses a semantic version string into a Version struct Accepts formats: "1.2.3", "v1.2.3", "1.2.3-alpha.1", "v1.2.3-beta.2"
func (Version) BaseVersion ¶ added in v0.4.0
BaseVersion returns a copy of this version without the PreRelease identifier
func (Version) Bump ¶ added in v0.2.0
Bump returns a new version with the specified change type applied. The returned version always has an empty PreRelease (clean bump). changeType should be one of: "patch", "minor", "major"
func (Version) Compare ¶
Compare compares this version with another version Returns: -1 if v < other, 0 if v == other, 1 if v > other Per semver spec: pre-release versions have lower precedence than the associated normal version. When both have pre-release identifiers, they are compared lexicographically.
func (Version) IsPreRelease ¶ added in v0.4.0
IsPreRelease returns true if this version has a pre-release identifier
func (Version) String ¶
String returns the string representation of the version (e.g., "1.2.3", "1.2.3-alpha.1", "1.2.3+build.123")
func (Version) WithBuildMetadata ¶ added in v0.4.0
WithBuildMetadata returns a copy of this version with the given build metadata
func (Version) WithPreRelease ¶ added in v0.4.0
WithPreRelease returns a copy of this version with the given pre-release identifier