Versions in this module Expand all Collapse all v0 v0.1.0 Jun 13, 2026 Changes in this version + const DefaultVersionDelimiter + var ErrEmptyConstraint = errors.New("empty constraint expression") + var ErrInvalidVersionInConstraint = errors.New("invalid version in constraint") + var ErrMissingVersionInConstraint = errors.New("missing version in constraint") + var ErrVersionInvalid = errors.New("version invalid") + func ContainsVersion(versions []*Version, target *Version) bool + func Count(versions []*Version, predicate func(*Version) bool) int + func Group(versions []*Version) map[string]*VersionGroup + func GroupByMajor(versions []*Version) map[int][]*Version + func GroupByMinor(versions []*Version) map[string][]*Version + func IndexOf(versions []*Version, target *Version) int + func Partition(versions []*Version, predicate func(*Version) bool) ([]*Version, []*Version) + func ReadVersionsStringFromFile(filepath string) ([]string, error) + func SortVersionGroupSlice(groupSlice []*VersionGroup) + func SortVersionStringSlice(versionStringSlice []string) []string + func VisualizeVersionGroups(versions []*Version, w io.Writer) + func VisualizeVersions(versions []*Version, w io.Writer, maxItems int) + func WriteVersionsToFile(versions []*Version, filepath string) error + type Constraint struct + Operator ConstraintOperator + Version *Version + func NegateConstraint(c *Constraint) *Constraint + func ParseConstraint(expr string) (*Constraint, error) + func (c *Constraint) Match(v *Version) bool + func (c *Constraint) String() string + type ConstraintOperator string + const ConstraintCaret + const ConstraintEqual + const ConstraintGreaterThan + const ConstraintGreaterThanOrEqual + const ConstraintLessThan + const ConstraintLessThanOrEqual + const ConstraintNotEqual + const ConstraintTilde + const ConstraintWildcard + type ConstraintSet struct + Constraints []Constraint + func ParseConstraintSet(expr string) (*ConstraintSet, error) + func (cs *ConstraintSet) Len() int + func (cs *ConstraintSet) Match(v *Version) bool + func (cs *ConstraintSet) Satisfies(v *Version) bool + func (cs *ConstraintSet) String() string + type ConstraintUnion struct + Sets []*ConstraintSet + func ParseConstraintUnion(expr string) (*ConstraintUnion, error) + func (cu *ConstraintUnion) Match(v *Version) bool + func (cu *ConstraintUnion) Satisfies(v *Version) bool + func (cu *ConstraintUnion) String() string + type ContainsPolicy int + const ContainsPolicyNo + const ContainsPolicyNone + const ContainsPolicyYes + func (p ContainsPolicy) String() string + type ParserOption struct + Delimiters string + func DefaultParserOption() ParserOption + type SortedVersionGroups struct + func NewSortedVersionGroups(versions []*Version) *SortedVersionGroups + func (x *SortedVersionGroups) At(index int) *VersionGroup + func (x *SortedVersionGroups) Contains(groupID string) bool + func (x *SortedVersionGroups) Get(groupID string) *VersionGroup + func (x *SortedVersionGroups) GroupIDs() []string + func (x *SortedVersionGroups) Len() int + func (x *SortedVersionGroups) QueryRange(start, end *tuple.Tuple2[*Version, ContainsPolicy]) []*Version + func (x *SortedVersionGroups) Versions() []*Version + type SuffixWeight int + const SuffixWeightAlpha + const SuffixWeightBeta + const SuffixWeightCR + const SuffixWeightDev + const SuffixWeightFinal + const SuffixWeightGA + const SuffixWeightMilestone + const SuffixWeightNightly + const SuffixWeightPatch + const SuffixWeightPost + const SuffixWeightPre + const SuffixWeightRC + const SuffixWeightRelease + const SuffixWeightSP + const SuffixWeightSnapshot + const SuffixWeightUnknown + func GetSuffixWeight(suffix string) SuffixWeight + func (w SuffixWeight) String() string + type Version struct + Metadata string + Prefix VersionPrefix + PublicTime time.Time + Raw string + Suffix VersionSuffix + VersionNumbers VersionNumbers + func Coerce(s string) *Version + func CoerceE(s string) (*Version, error) + func Difference(a, b []*Version) []*Version + func Filter(versions []*Version, predicate func(*Version) bool) []*Version + func FilterByConstraint(versions []*Version, constraint *Constraint) []*Version + func FilterByConstraintSet(versions []*Version, cs *ConstraintSet) []*Version + func FilterByMajor(versions []*Version, major int) []*Version + func FilterByMinor(versions []*Version, minor int) []*Version + func FilterByPatch(versions []*Version, patch int) []*Version + func FilterByPrefix(versions []*Version, prefix string) []*Version + func FilterByPrerelease(versions []*Version) []*Version + func FilterByStable(versions []*Version) []*Version + func FilterBySuffix(versions []*Version, suffix string) []*Version + func Intersection(a, b []*Version) []*Version + func LatestPrerelease(versions []*Version) *Version + func LatestStable(versions []*Version) *Version + func Max(versions []*Version) *Version + func Min(versions []*Version) *Version + func MustParse(versionStr string) *Version + func NewVersion(versionStr string) *Version + func NewVersionE(versionStr string) (*Version, error) + func NewVersionWithOption(versionStr string, option ParserOption) *Version + func NewVersions(versionStringSlice ...string) []*Version + func ReadVersionsFromFile(filepath string) ([]*Version, error) + func ReadVersionsFromReader(reader io.Reader) ([]*Version, error) + func SortVersionSlice(versions []*Version) []*Version + func Union(a, b []*Version) []*Version + func Unique(versions []*Version) []*Version + func (v *Version) IsValid() bool + func (x *Version) BuildGroupID() string + func (x *Version) BumpMajor() *Version + func (x *Version) BumpMinor() *Version + func (x *Version) BumpPatch() *Version + func (x *Version) Canonical() string + func (x *Version) Clone() *Version + func (x *Version) CompareTo(target *Version) int + func (x *Version) Core() *Version + func (x *Version) Diff(target *Version) *VersionDiff + func (x *Version) Equals(target *Version) bool + func (x *Version) Format(template string) string + func (x *Version) Hash() string + func (x *Version) Increment(segment int) *Version + func (x *Version) IsAlpha() bool + func (x *Version) IsBeta() bool + func (x *Version) IsBetween(low, high *Version) bool + func (x *Version) IsDev() bool + func (x *Version) IsFinal() bool + func (x *Version) IsGA() bool + func (x *Version) IsMilestone() bool + func (x *Version) IsNewerThan(target *Version) bool + func (x *Version) IsNightly() bool + func (x *Version) IsOlderThan(target *Version) bool + func (x *Version) IsPost() bool + func (x *Version) IsPre() bool + func (x *Version) IsPrerelease() bool + func (x *Version) IsRC() bool + func (x *Version) IsRelease() bool + func (x *Version) IsSP() bool + func (x *Version) IsSemver() bool + func (x *Version) IsSnapshot() bool + func (x *Version) IsStable() bool + func (x *Version) IsZero() bool + func (x *Version) Major() int + func (x *Version) Matches(expr string) (bool, error) + func (x *Version) Minor() int + func (x *Version) Patch() int + func (x *Version) PreReleaseType() string + func (x *Version) RawString() string + func (x *Version) Satisfies(constraint *Constraint) bool + func (x *Version) Scan(src interface{}) error + func (x *Version) Segments() []int + func (x *Version) Segments64() []int64 + func (x *Version) String() string + func (x *Version) SubVersion() int + func (x *Version) SuffixWeight() SuffixWeight + func (x *Version) UnmarshalJSON(data []byte) error + func (x *Version) UnmarshalText(text []byte) error + func (x *Version) Validate() error + func (x *Version) ValidateSemver() error + func (x *Version) WithMajor(major int) *Version + func (x *Version) WithMetadata(metadata string) *Version + func (x *Version) WithMinor(minor int) *Version + func (x *Version) WithNumbers(numbers []int) *Version + func (x *Version) WithPatch(patch int) *Version + func (x *Version) WithPrefix(prefix string) *Version + func (x *Version) WithPublicTime(t time.Time) *Version + func (x *Version) WithSuffix(suffix string) *Version + func (x Version) MarshalJSON() ([]byte, error) + func (x Version) MarshalText() ([]byte, error) + func (x Version) Value() (driver.Value, error) + type VersionBuilder struct + func NewVersionBuilder() *VersionBuilder + func (b *VersionBuilder) Build() *Version + func (b *VersionBuilder) Major(major int) *VersionBuilder + func (b *VersionBuilder) Metadata(metadata string) *VersionBuilder + func (b *VersionBuilder) Minor(minor int) *VersionBuilder + func (b *VersionBuilder) Numbers(numbers []int) *VersionBuilder + func (b *VersionBuilder) Patch(patch int) *VersionBuilder + func (b *VersionBuilder) Prefix(prefix string) *VersionBuilder + func (b *VersionBuilder) PublicTime(t time.Time) *VersionBuilder + func (b *VersionBuilder) Suffix(suffix string) *VersionBuilder + type VersionDiff struct + Major int + Minor int + Patch int + RawFrom string + RawTo string + func (d *VersionDiff) IsDowngrade() bool + func (d *VersionDiff) IsMajorChange() bool + func (d *VersionDiff) IsMinorChange() bool + func (d *VersionDiff) IsPatchChange() bool + func (d *VersionDiff) IsUpgrade() bool + func (d *VersionDiff) String() string + type VersionGroup struct + GroupVersionNumbers VersionNumbers + VersionMap map[string]*Version + func NewVersionGroup(groupVersionNumbers VersionNumbers) *VersionGroup + func NewVersionGroupFromVersions(versions []*Version) *VersionGroup + func SortVersionGroupMap(versionGroupMap map[string]*VersionGroup) []*VersionGroup + func (x *VersionGroup) Add(v *Version) bool + func (x *VersionGroup) CompareTo(target *VersionGroup) int + func (x *VersionGroup) Contains(v *Version) bool + func (x *VersionGroup) Count() int + func (x *VersionGroup) Filter(predicate func(*Version) bool) []*Version + func (x *VersionGroup) GetLatest() *Version + func (x *VersionGroup) GetOldest() *Version + func (x *VersionGroup) ID() string + func (x *VersionGroup) LatestPrerelease() *Version + func (x *VersionGroup) LatestStable() *Version + func (x *VersionGroup) PrereleaseVersions() []*Version + func (x *VersionGroup) QueryRangeVersions(start, end *tuple.Tuple2[*Version, ContainsPolicy]) []*Version + func (x *VersionGroup) Remove(v *Version) bool + func (x *VersionGroup) SortVersions() []*Version + func (x *VersionGroup) StableVersions() []*Version + func (x *VersionGroup) String() string + func (x *VersionGroup) Versions() []*Version + type VersionNumbers []int + func NewVersionNumbers(versionNumbers []int) VersionNumbers + func (x VersionNumbers) At(index int) int + func (x VersionNumbers) BuildGroupID() string + func (x VersionNumbers) CompareTo(target []int) int + func (x VersionNumbers) Equals(target VersionNumbers) bool + func (x VersionNumbers) Len() int + func (x VersionNumbers) String() string + type VersionPrefix string + const EmptyVersionPrefix + func (x VersionPrefix) IsEmpty() bool + func (x VersionPrefix) PurePrefix() string + func (x VersionPrefix) String() string + type VersionRange struct + High *Version + HighInclusive bool + Low *Version + LowInclusive bool + func NewClosedRange(low, high *Version) *VersionRange + func NewOpenRange(low, high *Version) *VersionRange + func NewVersionRange(low, high *Version, lowInclusive, highInclusive bool) *VersionRange + func (r *VersionRange) Contains(v *Version) bool + func (r *VersionRange) Filter(versions []*Version) []*Version + func (r *VersionRange) IsEmpty() bool + func (r *VersionRange) String() string + type VersionSlice []*Version + func (s VersionSlice) Contains(target *Version) bool + func (s VersionSlice) Filter(predicate func(*Version) bool) VersionSlice + func (s VersionSlice) IndexOf(target *Version) int + func (s VersionSlice) Len() int + func (s VersionSlice) Less(i, j int) bool + func (s VersionSlice) Max() *Version + func (s VersionSlice) Min() *Version + func (s VersionSlice) Sort() + func (s VersionSlice) Sorted() VersionSlice + func (s VersionSlice) Swap(i, j int) + func (s VersionSlice) Unique() VersionSlice + type VersionStringParser struct + func NewVersionStringParser(versionStr string) *VersionStringParser + func NewVersionStringParserWithOptions(versionStr string, option ParserOption) *VersionStringParser + func (x *VersionStringParser) IsDigit(c rune) bool + func (x *VersionStringParser) IsVersionNumberDelimiter(c rune) bool + func (x *VersionStringParser) Parse() *Version + type VersionSuffix string + const EmptyVersionSuffix + func (x VersionSuffix) CompareTo(target VersionSuffix) int + func (x VersionSuffix) IsEmpty() bool + func (x VersionSuffix) String() string