Documentation ¶
Overview ¶
Semantic Versions http://semver.org
Index ¶
- func Sort(versions []*Version)
- type PreRelease
- type Version
- func (v *Version) BumpMajor()
- func (v *Version) BumpMinor()
- func (v *Version) BumpPatch()
- func (v Version) Compare(versionB Version) int
- func (v Version) Equal(versionB Version) bool
- func (v Version) LessThan(versionB Version) bool
- func (v Version) MarshalJSON() ([]byte, error)
- func (v *Version) Set(version string) error
- func (v Version) Slice() []int64
- func (v Version) String() string
- func (v *Version) UnmarshalJSON(data []byte) error
- func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Versions
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PreRelease ¶
type PreRelease string
func (PreRelease) Slice ¶
func (p PreRelease) Slice() []string
type Version ¶
type Version struct { Major int64 Minor int64 Patch int64 PreRelease PreRelease Metadata string }
func NewVersion ¶
func (*Version) BumpMajor ¶
func (v *Version) BumpMajor()
BumpMajor increments the Major field by 1 and resets all other fields to their default values
func (*Version) BumpMinor ¶
func (v *Version) BumpMinor()
BumpMinor increments the Minor field by 1 and resets all other fields to their default values
func (*Version) BumpPatch ¶
func (v *Version) BumpPatch()
BumpPatch increments the Patch field by 1 and resets all other fields to their default values
func (Version) Compare ¶ added in v0.2.0
Compare tests if v is less than, equal to, or greater than versionB, returning -1, 0, or +1 respectively.
func (Version) LessThan ¶
LessThan tests if v is less than versionB.
Example ¶
vA := New("1.2.3") vB := New("3.2.1") fmt.Printf("%s < %s == %t\n", vA, vB, vA.LessThan(*vB))
Output: 1.2.3 < 3.2.1 == true
func (Version) MarshalJSON ¶
func (*Version) Set ¶ added in v0.2.0
Set parses and updates v from the given version string. Implements flag.Value
func (*Version) UnmarshalJSON ¶
func (*Version) UnmarshalYAML ¶
Click to show internal directories.
Click to hide internal directories.