Documentation
¶
Overview ¶
Package semver contains Semantic Versioning 2.0.0 support for Go.
Index ¶
- func Compare(sv1, sv2 SemVer) (int, error)
- func Less(sv1, sv2 SemVer) bool
- func Valid(sv SemVer) error
- type SemVer
- func (v SemVer) CompareTo(other SemVer) (int, error)
- func (v SemVer) EqualTo(other SemVer) (bool, error)
- func (v SemVer) IsValid() bool
- func (v SemVer) LessThan(other SemVer) (bool, error)
- func (v SemVer) MarshalText() ([]byte, error)
- func (v SemVer) MoreThan(other SemVer) (bool, error)
- func (v SemVer) String() string
- func (v *SemVer) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
Compare compares 'sv1' with 'sv2'. Compare returns -1 if 'sv1' is less than 'sv2', 0 if 'sv1' is equal to 'sv2', 1 if 'sv1' is more than 'sv2'.
Types ¶
type SemVer ¶
type SemVer struct {
// Major contains SemVer's [major version].
//
// [major version]: https://semver.org/#spec-item-8
Major int
// Minor contains SemVer's [minor version].
//
// [minor version]: https://semver.org/#spec-item-7
Minor int
// Patch contains SemVer's [patch version].
//
// [patch version]: https://semver.org/#spec-item-6
Patch int
// PreRelease contains SemVer's [pre-release version].
//
// [pre-release version]: https://semver.org/#spec-item-9
PreRelease string
// Build contains SemVer's [build metadata].
//
// [build metadata]: https://semver.org/#spec-item-10
Build string
}
SemVer represents Semantic Versioning Specification. SemVer's zero value is "0.0.0" version.
func (SemVer) CompareTo ¶
CompareTo compares 'v' with 'other'. CompareTo returns -1 if 'v' is less than 'other', 0 if 'v' is equal to 'other', 1 if 'v' is more than 'other'.
func (SemVer) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (SemVer) String ¶
String implements the fmt.Stringer interface.
func (*SemVer) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
Click to show internal directories.
Click to hide internal directories.