Documentation ¶
Index ¶
- Variables
- func Parts(raw string) ([]string, error)
- type Collection
- type Constraint
- type Constraints
- type Error
- type Pre
- type Version
- func (v *Version) Compare(o *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) LessThan(o *Version) bool
- func (v *Version) LessThanOrEqual(o *Version) bool
- func (v *Version) NotEqual(o *Version) bool
- func (v *Version) String() string
- func (v *Version) StringWithMeta() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //Exported vars. ErrorMalformedVersionPre = Error{"Malformed Version Pre part: %s", ""} PrereleaseTags = []string{"pre", "alpha", "beta", "rc"} )
View Source
var (
ErrorMalformedVersion = Error{"Malformed Version: %s", ""}
)
View Source
var (
ErrorVersionNotFound = Error{"Version %s not found.", ""}
)
Functions ¶
Types ¶
type Collection ¶
type Collection []*Version
Collection is a type that implements the sort.Interface interface so that versions can be sorted.
func NewCollection ¶
func NewCollection(raws []string) (Collection, error)
func (Collection) Len ¶
func (vc Collection) Len() int
func (Collection) Less ¶
func (vc Collection) Less(i, j int) bool
TODO: Check why sort.Reverse isn't working.
func (Collection) Swap ¶
func (vc Collection) Swap(i, j int)
type Constraint ¶
type Constraint struct {
// contains filtered or unexported fields
}
Constraint represents a single constraint for a version, such as ">= 1.0".
func (*Constraint) Check ¶
func (c *Constraint) Check(v *Version) bool
Check tests if a constraint is validated by the given version.
func (*Constraint) String ¶
func (c *Constraint) String() string
type Constraints ¶
type Constraints []*Constraint
Constraints is a slice of constraints. We make a custom type so that we can add methods to it.
func NewConstraint ¶
func NewConstraint(v string) (Constraints, error)
NewConstraint will parse one or more constraints from the given constraint string. The string must be a comma-separated list of constraints.
func (Constraints) Check ¶
func (cs Constraints) Check(v *Version) bool
Check tests if a version satisfies all the constraints.
func (Constraints) String ¶
func (cs Constraints) String() string
Returns the string format of the constraints
type Version ¶
type Version struct { Raw string Product string Major uint16 Minor uint16 Patch uint16 Pre *Pre Meta string }
func NewVersion ¶
func (*Version) GreaterThan ¶
func (*Version) GreaterThanOrEqual ¶
func (*Version) LessThanOrEqual ¶
func (*Version) StringWithMeta ¶
Click to show internal directories.
Click to hide internal directories.