Documentation
¶
Overview ¶
Package version provides version comparison and filtering utilities.
Index ¶
- Constants
- func Compare(v1, v2 string) (int, error)
- func CompareVersions(v1, v2 string) (int, error)
- func FindMaxVersion(versions []string) (string, error)
- func IsCompatible(pluginVersion, paperVersion string) (bool, error)
- func IsDowngrade(currentVersion, candidateVersion string) (bool, error)
- func ParseVersion(version string) (*semver.Version, error)
- type VersionInfo
Constants ¶
const (
// Latest represents the special "latest" version tag.
Latest = "latest"
)
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
Compare compares two version strings using semantic versioning. Returns:
-1 if v1 < v2 0 if v1 == v2 1 if v1 > v2
func CompareVersions ¶
CompareVersions compares two version strings. Returns:
- -1 if v1 < v2
- 0 if v1 == v2
- 1 if v1 > v2
- error if either version is invalid
func FindMaxVersion ¶
FindMaxVersion finds the maximum version from a list of version strings. Returns empty string if the list is empty or all versions are invalid.
func IsCompatible ¶
IsCompatible checks if a plugin version is compatible with a Paper version. This is a simple string equality check for now, but can be extended to support version ranges and constraints.
func IsDowngrade ¶
IsDowngrade checks if changing from currentVersion to candidateVersion would be a downgrade.
Types ¶
type VersionInfo ¶
type VersionInfo struct {
// Version is the version string.
Version string
// ReleaseDate is when this version was released.
ReleaseDate time.Time
}
VersionInfo contains metadata about a specific version.
func FilterByUpdateDelay ¶
func FilterByUpdateDelay(versions []VersionInfo, delay time.Duration) []VersionInfo
FilterByUpdateDelay filters versions based on release date and update delay. Only versions released before (now - delay) are returned. If delay is zero, all versions are returned.