Documentation
¶
Index ¶
- type ArtHelper
- type Helper
- func (g *Helper) GetLatest() (*hscvrs.Version, error)
- func (g *Helper) GetLatestMajor(major int) (*hscvrs.Version, error)
- func (g *Helper) GetLatestMinor(major, minor int) (*hscvrs.Version, error)
- func (g *Helper) ListReleasesMajor(major int) (hscvrs.Collection, error)
- func (g *Helper) ListReleasesMinor(major, minor int) (hscvrs.Collection, error)
- func (g *Helper) ListReleasesOrder() (map[int]map[int]hscvrs.Collection, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtHelper ¶ added in v1.19.0
type ArtHelper interface {
// ListReleasesOrder returns a two-level map of releases organized by major and minor versions.
// Structure: map[major]map[minor]Collection
//
// Example result:
// {
// 1: {0: [1.0.0, 1.0.1], 2: [1.2.0, 1.2.1, 1.2.5]},
// 2: {0: [2.0.0], 1: [2.1.3, 2.1.9]}
// }
ListReleasesOrder() (releases map[int]map[int]hscvrs.Collection, err error)
// ListReleasesMajor returns a sorted slice of versions with the given major version number.
// The slice is sorted in ascending order by minor version number.
//
// Example: ListReleasesMajor(1) will return a slice of all versions with major version number 1,
// sorted by minor version number in ascending order.
//
// It returns an error if the given major version number is not found in the list of releases.
//
// The returned slice is a subset of the results returned by ListReleasesOrder().
ListReleasesMajor(major int) (releases hscvrs.Collection, err error)
// ListReleasesMinor returns a sorted slice of versions with the given major and minor version numbers.
//
// Example: ListReleasesMinor(1, 2) will return a slice of all versions with major version number 1 and minor version number 2,
// sorted by version in ascending order.
//
// It returns an error if the given major and minor version numbers are not found in the list of releases.
//
// The returned slice is a subset of the results returned by ListReleasesOrder().
ListReleasesMinor(major, minor int) (releases hscvrs.Collection, err error)
// GetLatest returns the highest version in the list of releases.
// The version is sorted by major version number in descending order, and by minor version number in descending order.
// If the list of releases is empty, it returns an error.
//
// Example: GetLatest() will return the highest version in the list of releases, sorted by major version number in descending order, and by minor version number in descending order.
//
// It returns an error if the list of releases is empty.
GetLatest() (release *hscvrs.Version, err error)
// GetLatestMajor returns the highest version in the list of releases with the given major version number.
//
// The version is sorted by minor version number in descending order.
// If the list of releases with the given major version number is empty, it returns an error.
//
// Example: GetLatestMajor(1) will return the highest version in the list of releases with major version number 1,
// sorted by minor version number in descending order.
//
// It returns an error if the list of releases with the given major version number is empty.
GetLatestMajor(major int) (release *hscvrs.Version, err error)
// GetLatestMinor returns the highest version in the list of releases with the given major and minor version numbers.
//
// The version is sorted by version in descending order.
// If the list of releases with the given major and minor version numbers is empty, it returns an error.
//
// Example: GetLatestMinor(1, 2) will return the highest version in the list of releases with major version number 1 and minor version number 2,
// sorted by version in descending order.
//
// It returns an error if the list of releases with the given major and minor version numbers is empty.
GetLatestMinor(major, minor int) (release *hscvrs.Version, err error)
}
ArtHelper provides version organization and retrieval methods. This interface is embedded in the main artifact.Client interface and provides hierarchical access to versions organized by major/minor version numbers.
All methods automatically filter out pre-release versions (alpha, beta, rc, etc.) and return only stable, production-ready releases.
type Helper ¶ added in v1.19.0
type Helper struct {
F func() (releases hscvrs.Collection, err error)
}
Helper wraps a function that returns version collections and provides convenient methods for organizing, filtering, and retrieving versions. This struct is embedded in all platform-specific implementations (GitHub, GitLab, JFrog, S3).
Example usage:
h := &Helper{F: client.ListReleases}
latest, err := h.GetLatest() // Get latest overall version
v2Latest, err := h.GetLatestMajor(2) // Get latest v2.x.x version
func (*Helper) GetLatest ¶ added in v1.19.0
GetLatest implements ArtHelper.GetLatest. Returns the highest version across all major and minor versions. Determines the latest by finding the highest major version, then the highest minor within that major, and finally the highest patch version.
func (*Helper) GetLatestMajor ¶ added in v1.19.0
GetLatestMajor implements ArtHelper.GetLatestMajor. Returns the highest version within the specified major version number. First finds the highest minor version for the given major, then returns the highest patch version within that major.minor combination.
func (*Helper) GetLatestMinor ¶ added in v1.19.0
GetLatestMinor implements ArtHelper.GetLatestMinor. Returns the highest version (by patch number) within the specified major.minor version. Iterates through all versions in the collection and returns the highest one.
func (*Helper) ListReleasesMajor ¶ added in v1.19.0
func (g *Helper) ListReleasesMajor(major int) (hscvrs.Collection, error)
ListReleasesMajor implements ArtHelper.ListReleasesMajor. Returns all versions with the specified major version number, sorted in ascending order. Returns an empty collection if the major version is not found.
func (*Helper) ListReleasesMinor ¶ added in v1.19.0
func (g *Helper) ListReleasesMinor(major, minor int) (hscvrs.Collection, error)
ListReleasesMinor implements ArtHelper.ListReleasesMinor. Returns all versions matching the specified major and minor version numbers. The returned collection is sorted in ascending order. Returns an empty collection if the major/minor combination is not found.
func (*Helper) ListReleasesOrder ¶ added in v1.19.0
ListReleasesOrder implements ArtHelper.ListReleasesOrder. Returns a nested map structure organizing versions by major and minor version numbers. Structure: map[major]map[minor]Collection
Example:
{1: {0: [1.0.0, 1.0.1], 2: [1.2.0, 1.2.5]}, 2: {1: [2.1.3, 2.1.9]}}