Documentation
¶
Index ¶
- Constants
- func CategoriesProvider(pkg packages.Server) []string
- func DefaultCacheDir() (string, error)
- func DefaultCacheTTL() *config.Duration
- func DefaultMatchers() map[string]Predicate
- func DisplayNameProvider(pkg packages.Server) string
- func IDProvider(pkg packages.Server) string
- func IsOfficialProvider(pkg packages.Server) bool
- func LicenseProvider(pkg packages.Server) string
- func Match(pkg packages.Server, filters map[string]string, opts ...Option) (bool, error)
- func NameProvider(pkg packages.Server) string
- func PrepareFilters(filters map[string]string, name string, ...) (map[string]string, error)
- func ResolveFilters(opts ResolveOptions) map[string]string
- func RuntimesProvider(pkg packages.Server) []string
- func SourceProvider(pkg packages.Server) string
- func TagsProvider(pkg packages.Server) []string
- func ToolsProvider(pkg packages.Server) []string
- func VersionsProvider(pkg packages.Server) []string
- type BoolValueProvider
- type BuildOption
- type BuildOptions
- type Option
- func WithCategoriesMatcher(provider StringValuesProvider) Option
- func WithDefaultMatchers() Option
- func WithIsOfficialMatcher(provider BoolValueProvider) Option
- func WithLicenseMatcher(provider StringValueProvider) Option
- func WithLogFunc(fn func(key, val string)) Option
- func WithNameMatcher() Option
- func WithRuntimeMatcher(provider StringValuesProvider) Option
- func WithSourceMatcher(provider StringValueProvider) Option
- func WithTagsMatcher(provider StringValuesProvider) Option
- func WithToolsMatcher(provider StringValuesProvider) Option
- func WithUnsupportedKeys(keys ...string) Option
- func WithVersionMatcher(provider StringValueProvider) Option
- type Predicate
- type ResolveOption
- type ResolveOptions
- type SearchOption
- type SearchOptions
- type StringValueProvider
- type StringValuesProvider
Constants ¶
const ( // WildcardCharacter represents the character that can be supplied // to searches to find 'all' results (before filtering). // It is explicitly intended to be used in relation to querying a name. WildcardCharacter = "*" // FilterKeyName is the key to use for filtering 'name'. FilterKeyName = "name" // FilterKeyRuntime is the key to use for filtering 'runtime'. FilterKeyRuntime = "runtime" // FilterKeyTools is the key to use for filtering 'tools'. FilterKeyTools = "tools" // FilterKeyTags is the key to use for filtering 'tags'. FilterKeyTags = "tags" // FilterKeyCategories is the key to use for filtering 'categories'. FilterKeyCategories = "categories" // FilterKeyVersion is the key to use for filtering 'version'. FilterKeyVersion = "version" // FilterKeyLicense is the key to use for filtering 'license'. FilterKeyLicense = "license" // FilterKeySource is the key to use for filtering 'source'. FilterKeySource = "source" // FilterKeyIsOfficial is the key to use for filtering 'isOfficial'. FilterKeyIsOfficial = "isOfficial" )
Variables ¶
This section is empty.
Functions ¶
func CategoriesProvider ¶
func DefaultCacheDir ¶
DefaultCacheDir returns the default cache directory for registry manifests.
func DefaultCacheTTL ¶
DefaultCacheTTL returns the default cache time-to-live.
func DefaultMatchers ¶
func DisplayNameProvider ¶
func IDProvider ¶
func IsOfficialProvider ¶
func LicenseProvider ¶
func Match ¶
Match filters a packages.Server using optional predicate matchers defined by the supplied filter keys. Each filter key corresponds to a predicate that (if supplied) evaluates a specific field in the packages.Server.
func NameProvider ¶
func PrepareFilters ¶
func PrepareFilters( filters map[string]string, name string, mutateFunc func(map[string]string) error, ) (map[string]string, error)
PrepareFilters returns a new map based on the provided filters, ensuring that the FilterKeyName is injected. If a registry-specific mutation function is provided, it is applied after the name injection. If the mutation function returns an error, PrepareFilters returns that error.
func ResolveFilters ¶
func ResolveFilters(opts ResolveOptions) map[string]string
func RuntimesProvider ¶
func SourceProvider ¶
func TagsProvider ¶
func ToolsProvider ¶
func VersionsProvider ¶
Types ¶
type BoolValueProvider ¶
type BoolValueProvider = filter.BoolValueProvider[packages.Server]
BoolValueProvider is used to provide a specific boolean value from a packages.Server.
type BuildOption ¶
type BuildOption func(*BuildOptions) error
BuildOption defines a functional option for configuring registry builds.
func WithCacheDir ¶
func WithCacheDir(dir string) BuildOption
WithCacheDir configures the cache directory.
func WithCacheTTL ¶
func WithCacheTTL(ttl time.Duration) BuildOption
WithCacheTTL configures the cache time-to-live.
func WithCaching ¶
func WithCaching(enabled bool) BuildOption
WithCaching configures whether caching is enabled.
func WithRefreshCache ¶
func WithRefreshCache(refreshCache bool) BuildOption
WithRefreshCache configures whether to force cache refresh.
type BuildOptions ¶
type BuildOptions struct {
// UseCache determines if registry manifest caching should be used.
UseCache bool
// RefreshCache forces refresh of cached registry manifests.
RefreshCache bool
// CacheDir specifies the cache directory (empty uses default).
CacheDir string
// CacheTTL specifies the cache time-to-live (zero uses default).
CacheTTL time.Duration
}
BuildOptions contains configuration for building a registry. NewBuildOptions should be used to create instances of BuildOptions.
func NewBuildOptions ¶
func NewBuildOptions(opts ...BuildOption) (BuildOptions, error)
NewBuildOptions creates BuildOptions with optional configurations applied. Starts with default values, then applies options in order with later options overriding earlier ones.
type Option ¶
Option for providing a packages.Server.
func WithCategoriesMatcher ¶
func WithCategoriesMatcher(provider StringValuesProvider) Option
WithCategoriesMatcher returns a filter.Option with a matcher configured for the "categories" filter key. The matcher is applied during Match only if the categories filter key is present in the filters map. This matcher returns true if all the filter values are found in the package's categories as substrings. Matching is case-insensitive and uses normalized values.
func WithDefaultMatchers ¶
func WithDefaultMatchers() Option
func WithIsOfficialMatcher ¶
func WithIsOfficialMatcher(provider BoolValueProvider) Option
WithIsOfficialMatcher returns a filter.Option with a matcher configured for the 'is Official' filter key. The matcher is applied during Match only if the 'is_official' filter key is present in the filters map. This matcher performs boolean comparison on a parsed input string value, with the provided field.
func WithLicenseMatcher ¶
func WithLicenseMatcher(provider StringValueProvider) Option
WithLicenseMatcher returns a filter.Option with a matcher configured for the "license" filter key. The matcher is applied during Match only if the license filter key is present in the filters map. This matcher performs case-insensitive substring matching on the license field.
func WithLogFunc ¶
WithLogFunc sets a log function which will be used to log info if unsupported keys are encountered.
func WithNameMatcher ¶
func WithNameMatcher() Option
WithNameMatcher returns a filter.Option with a matcher configured for the "name" filter key. The matcher is applied during Match only if the name filter key is present in the filters map. This matcher performs case-insensitive substring matching across Name, DisplayName, and ID fields. If the filter value is "*", all packages match unconditionally.
func WithRuntimeMatcher ¶
func WithRuntimeMatcher(provider StringValuesProvider) Option
WithRuntimeMatcher returns a filter.Option with a matcher configured for the "runtime" filter key. The matcher is applied during Match only if the runtime filter key is present in the filters map. Matching is case-insensitive and uses normalized values.
func WithSourceMatcher ¶
func WithSourceMatcher(provider StringValueProvider) Option
WithSourceMatcher returns a filter.Option with a matcher configured for the "source" filter key. The matcher is applied during Match only if the source filter key is present in the filters map. This matcher performs case-insensitive equality matching on the source field.
func WithTagsMatcher ¶
func WithTagsMatcher(provider StringValuesProvider) Option
WithTagsMatcher returns a filter.Option with a matcher configured for the "tags" filter key. The matcher is applied during Match only if the tags filter key is present in the filters map. This matcher returns true if all the filter values are found in the package's tag as substrings. Matching is case-insensitive and uses normalized values.
func WithToolsMatcher ¶
func WithToolsMatcher(provider StringValuesProvider) Option
WithToolsMatcher returns a filter.Option with a matcher configured for the "tools" filter key. The matcher is applied during Match only if the tools filter key is present in the filters map. This matcher returns true only if all filter values are found in the package's tools. Matching is case-insensitive and uses normalized values.
func WithUnsupportedKeys ¶
WithUnsupportedKeys marks specific keys as unsupported when used for filtering.
func WithVersionMatcher ¶
func WithVersionMatcher(provider StringValueProvider) Option
WithVersionMatcher returns a filter.Option with a matcher configured for the "version" filter key. The matcher is applied during Match only if the version filter key is present in the filters map. This matcher performs case-insensitive equality matching on the version field.
type ResolveOption ¶
type ResolveOption func(*ResolveOptions) error
func WithResolveRuntime ¶
func WithResolveRuntime(runtime runtime.Runtime) ResolveOption
func WithResolveSource ¶
func WithResolveSource(source string) ResolveOption
func WithResolveVersion ¶
func WithResolveVersion(version string) ResolveOption
type ResolveOptions ¶
func NewResolveOptions ¶
func NewResolveOptions(opt ...ResolveOption) (ResolveOptions, error)
type SearchOption ¶
type SearchOption func(*SearchOptions) error
func WithSearchSource ¶
func WithSearchSource(source string) SearchOption
type SearchOptions ¶
type SearchOptions struct {
Source string
}
func NewSearchOptions ¶
func NewSearchOptions(opt ...SearchOption) (SearchOptions, error)
type StringValueProvider ¶
type StringValueProvider = filter.StringValueProvider[packages.Server]
StringValueProvider is used to provide a specific string value from a packages.Server.
type StringValuesProvider ¶
type StringValuesProvider = filter.StringValuesProvider[packages.Server]
StringValuesProvider is used to provide a specific string slice value from a packages.Server.