version: github.com/juju/version Index | Files

package version

import "github.com/juju/version"

Package version implements version parsing.

Index

Package Files

version.go

Variables

var Zero = Number{}

Zero is occasionally convenient and readable. Please don't change its value.

func ParseMajorMinor Uses

func ParseMajorMinor(vers string) (int, int, error)

ParseMajorMinor takes an argument of the form "major.minor" and returns ints major and minor.

type Binary Uses

type Binary struct {
    Number
    Series string
    Arch   string
}

Binary specifies a binary version of juju.v

func MustParseBinary Uses

func MustParseBinary(s string) Binary

MustParseBinary parses a binary version and panics if it does not parse correctly.

func ParseBinary Uses

func ParseBinary(s string) (Binary, error)

ParseBinary parses a binary version of the form "1.2.3-series-arch".

func (Binary) GetBSON Uses

func (b Binary) GetBSON() (interface{}, error)

GetBSON implements bson.Getter.

func (Binary) MarshalJSON Uses

func (b Binary) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Binary) MarshalYAML Uses

func (b Binary) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.v2.Marshaller interface.

func (*Binary) SetBSON Uses

func (b *Binary) SetBSON(raw bson.Raw) error

SetBSON implements bson.Setter.

func (Binary) String Uses

func (b Binary) String() string

String returns the string representation of the binary version.

func (*Binary) UnmarshalJSON Uses

func (b *Binary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Binary) UnmarshalYAML Uses

func (b *Binary) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaller interface.

type Number Uses

type Number struct {
    Major int
    Minor int
    Tag   string
    Patch int
    Build int
}

Number represents a version number.

func MustParse Uses

func MustParse(s string) Number

MustParse parses a version and panics if it does not parse correctly.

func Parse Uses

func Parse(s string) (Number, error)

Parse parses the version, which is of the form 1.2.3 giving the major, minor and release versions respectively.

func (Number) Compare Uses

func (n Number) Compare(other Number) int

Compare returns -1, 0 or 1 depending on whether n is less than, equal to or greater than other. The comparison compares Major, then Minor, then Patch, then Build, using the first difference as

func (Number) GetBSON Uses

func (n Number) GetBSON() (interface{}, error)

GetBSON implements bson.Getter.

func (Number) MarshalJSON Uses

func (n Number) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (Number) MarshalYAML Uses

func (n Number) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.v2.Marshaller interface

func (*Number) SetBSON Uses

func (n *Number) SetBSON(raw bson.Raw) error

SetBSON implements bson.Setter.

func (Number) String Uses

func (n Number) String() string

String returns the string representation of this Number.

func (*Number) UnmarshalJSON Uses

func (n *Number) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Number) UnmarshalYAML Uses

func (n *Number) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaller interface

Package version imports 6 packages (graph) and is imported by 1281 packages. Updated 2018-01-08. Refresh now. Tools for package owners.