Documentation
¶
Index ¶
Constants ¶
const ( // REGEXVERSIONKIND represents versions as a simple string REGEXVERSIONKIND string = "regex" // SEMVERVERSIONKIND represents versions as a semantic versioning type SEMVERVERSIONKIND string = "semver" // LATESTVERSIONKIND specifies that we are looking for the latest version of an array LATESTVERSIONKIND string = "latest" // REGEXSEMVERVERSIONKIND use regex to extract versions and semantic version to find version REGEXSEMVERVERSIONKIND string = "regex/semver" // REGEXTIMEVERSIONKIND use regex to extract all date matching format to find version REGEXTIMEVERSIONKIND string = "regex/time" // TIMEVERSIONKIND represents versions use date format to identify the version TIMEVERSIONKIND string = "time" // LEXSORTVERSIONKIND uses the go sort package to find the latest version LEXVERSIONKIND string = "lex" )
Variables ¶
var ( // ErrNoVersionFound return a error when no version couldn't be found ErrNoVersionFound error = errors.New("no version found") // ErrNoVersionsFound return a error when the versions list is empty ErrNoVersionsFound error = errors.New("versions list empty") // ErrNoValidSemVerFound return a error when the versions list is empty ErrNoValidSemVerFound error = errors.New("no valid semantic version found") // ErrNoValidDateFound return a error when the versions list is empty ErrNoValidDateFound error = errors.New("no valid date found") )
var SupportedKind []string = []string{ REGEXVERSIONKIND, SEMVERVERSIONKIND, LATESTVERSIONKIND, REGEXSEMVERVERSIONKIND, REGEXTIMEVERSIONKIND, TIMEVERSIONKIND, LEXVERSIONKIND, }
SupportedKind holds a list of supported version kind
Functions ¶
This section is empty.
Types ¶
type ErrIncorrectSemVerConstraint ¶ added in v0.55.0
type ErrIncorrectSemVerConstraint struct {
SemVerConstraint string
}
ErrUnsupportedVersionKind returns when the provided combination of version and pattern filter is unsupported
func (*ErrIncorrectSemVerConstraint) Error ¶ added in v0.55.0
func (e *ErrIncorrectSemVerConstraint) Error() string
type ErrNoVersionFoundForPattern ¶ added in v0.55.0
type ErrNoVersionFoundForPattern struct {
Pattern string
}
ErrNoVersionFoundForPattern returns when a given pattern does not find any version
func (*ErrNoVersionFoundForPattern) Error ¶ added in v0.55.0
func (e *ErrNoVersionFoundForPattern) Error() string
type ErrUnsupportedVersionKind ¶ added in v0.55.0
type ErrUnsupportedVersionKind struct {
Kind string
}
ErrUnsupportedVersionKind returns when the provided version filter is unsupported
func (*ErrUnsupportedVersionKind) Error ¶ added in v0.55.0
func (e *ErrUnsupportedVersionKind) Error() string
type ErrUnsupportedVersionKindPattern ¶ added in v0.55.0
ErrUnsupportedVersionKind returns when the provided combination of version and pattern filter is unsupported
func (*ErrUnsupportedVersionKindPattern) Error ¶ added in v0.55.0
func (e *ErrUnsupportedVersionKindPattern) Error() string
type Filter ¶
type Filter struct {
// specifies the version kind such as semver, regex, or latest
Kind string `yaml:",omitempty"`
// specifies the version pattern according the version kind
// for semver, it is a semver constraint
// for regex, it is a regex pattern
// for time, it is a date format
Pattern string `yaml:",omitempty"`
// strict enforce strict versioning rule.
// Only used for semantic versioning at this time
Strict bool `yaml:",omitempty"`
// specifies the regex pattern, used for regex/semver and regex/time.
// Output of the first capture group will be used.
Regex string `yaml:",omitempty"`
}
Filter defines parameters to apply different kind of version matching based on a list of versions
func (*Filter) GreaterThanPattern ¶ added in v0.49.0
GreaterThanPattern returns a pattern that can be used to find newer version
type Semver ¶
type Semver struct {
Constraint string
FoundVersion Version
Strict bool
// contains filtered or unexported fields
}
Semver is an interface in front the masterminds/semver used across the updatecli project
type Time ¶ added in v0.92.0
type Time struct {
FoundVersion Version
// contains filtered or unexported fields
}
type Version ¶
TODO: Remove this struct once https://github.com/updatecli/updatecli/issues/803 is fixed. Version defines a version from a filter that holds both the original found version and the parsed version (depending on the kind of filter: semantic, text, etc.) Keeping the original found versions is useful when checking for metadata around the version, such as the changelog
func (Version) GetVersion ¶ added in v0.30.0
TODO: Change the receiver of this function to Filter once https://github.com/updatecli/updatecli/issues/803 is fixed.