Documentation
¶
Index ¶
- type AllowLocalSpecifier
- type SpecifierOption
- type Specifiers
- type Version
- func (v Version) BaseVersion() string
- func (v Version) Compare(other Version) int
- func (v Version) Equal(o Version) bool
- func (v Version) GreaterThan(o Version) bool
- func (v Version) GreaterThanOrEqual(o Version) bool
- func (v Version) IsPostRelease() bool
- func (v Version) IsPreRelease() bool
- func (v Version) LessThan(o Version) bool
- func (v Version) LessThanOrEqual(o Version) bool
- func (v Version) Local() string
- func (v Version) MarshalText() ([]byte, error)
- func (v Version) Original() string
- func (v Version) Public() string
- func (v Version) String() string
- func (v *Version) UnmarshalText(data []byte) error
- type WithPreRelease
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowLocalSpecifier ¶
type AllowLocalSpecifier bool
AllowLocalSpecifier is an option that allows local version labels in specifiers. By default (PEP 440), local versions are not permitted in specifiers and local version labels are ignored when checking if candidate versions match a given specifier. When enabled, specifiers like ">= 1.0+local.1" become valid and local version segments are compared strictly.
type SpecifierOption ¶
type SpecifierOption interface {
// contains filtered or unexported methods
}
type Specifiers ¶
type Specifiers struct {
// contains filtered or unexported fields
}
func NewSpecifiers ¶
func NewSpecifiers(v string, opts ...SpecifierOption) (Specifiers, error)
NewSpecifiers parses a given specifier and returns a new instance of Specifiers
func (Specifiers) Check ¶
func (ss Specifiers) Check(v Version) bool
Check tests if a version satisfies all the specifiers.
func (Specifiers) String ¶
func (ss Specifiers) String() string
String returns the string format of the specifiers
func (Specifiers) ToVersionRange ¶
func (ss Specifiers) ToVersionRange() (versionrange.Range[Version], error)
ToVersionRange lowers the specifiers to the generic versionrange model, enabling cross-ecosystem range algebra (Intersect, Union, Complement).
Specifiers with an explicit local version ("==1.0+local") and ">" specifiers whose version is not a post-release cannot be represented: PEP 440's post-release exclusion for ">" is not a contiguous interval. "~=" is only supported for plain release versions.
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents a single version.
func (Version) BaseVersion ¶
BaseVersion returns the base version
func (Version) Compare ¶
Compare compares this version to another version. This returns -1, 0, or 1 if this version is smaller, equal, or larger than the other version, respectively.
func (Version) GreaterThan ¶
GreaterThan tests if this version is greater than another version.
func (Version) GreaterThanOrEqual ¶
GreaterThanOrEqual tests if this version is greater than or equal to another version.
func (Version) IsPostRelease ¶
IsPostRelease returns if it is a post-release
func (Version) IsPreRelease ¶
IsPreRelease returns if it is a pre-release
func (Version) LessThanOrEqual ¶
LessThanOrEqual tests if this version is less than or equal to another version.
func (Version) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Version) Original ¶
Original returns the original parsed version as-is, including any potential whitespace, `v` prefix, etc.
func (Version) String ¶
String returns the full version string included pre-release and metadata information.
func (*Version) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type WithPreRelease ¶
type WithPreRelease bool