version

package module
v0.0.0-...-ef897ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2015 License: LGPL-3.0 Imports: 7 Imported by: 0

README

Version GoDoc

version is a go package for intelligent version comparisons.

Documentation

Overview

Package version implements version parsing.

Index

Constants

This section is empty.

Variables

View Source
var Zero = Number{}

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

Functions

func ParseMajorMinor

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

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

Types

type Binary

type Binary struct {
	Number
	Series string
	Arch   string
}

Binary specifies a binary version of juju.v

func MustParseBinary

func MustParseBinary(s string) Binary

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

func ParseBinary

func ParseBinary(s string) (Binary, error)

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

func (Binary) GetBSON

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

GetBSON implements bson.Getter.

func (Binary) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Binary) MarshalYAML

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

MarshalYAML implements yaml.v2.Marshaller interface.

func (*Binary) SetBSON

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

SetBSON implements bson.Setter.

func (Binary) String

func (b Binary) String() string

String returns the string representation of the binary version.

func (*Binary) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Binary) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaller interface.

type Number

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

Number represents a version number.

func MustParse

func MustParse(s string) Number

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

func Parse

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

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

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

GetBSON implements bson.Getter.

func (Number) MarshalJSON

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

MarshalJSON implements json.Marshaler.

func (Number) MarshalYAML

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

MarshalYAML implements yaml.v2.Marshaller interface

func (*Number) SetBSON

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

SetBSON implements bson.Setter.

func (Number) String

func (n Number) String() string

String returns the string representation of this Number.

func (*Number) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler.

func (*Number) UnmarshalYAML

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

UnmarshalYAML implements the yaml.Unmarshaller interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL