version

package
v0.0.0-...-a1557c0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: BSD-3-Clause, MIT Imports: 5 Imported by: 0

Documentation

Overview

version is a pure-go implementation of dpkg version string functions (parsing, comparison) which is compatible with dpkg(1).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a Version, b Version) int

Compare compares the two provided Debian versions. It returns 0 if a and b are equal, a value < 0 if a is smaller than b and a value > 0 if a is greater than b.

Types

type Slice

type Slice []Version

Slice is a slice versions, satisfying sort.Interface

func (Slice) Len

func (a Slice) Len() int

func (Slice) Less

func (a Slice) Less(i, j int) bool

func (Slice) Swap

func (a Slice) Swap(i, j int)

type Version

type Version struct {
	Epoch    uint
	Version  string
	Revision string
}

func ComparableStringToVersion

func ComparableStringToVersion(s string) (ret Version, err error)

func Parse

func Parse(input string) (Version, error)

Parse returns a Version struct filled with the epoch, version and revision specified in input. It verifies the version string as a whole, just like dpkg(1), and even returns roughly the same error messages.

func (Version) ComparableString

func (v Version) ComparableString() string

Comparable string. To be used as precomputed value for fast comparisons. E.g., in SQL table.

func (*Version) Empty

func (v *Version) Empty() bool

func (*Version) IsNative

func (v *Version) IsNative() bool

func (Version) MarshalControl

func (version Version) MarshalControl() (string, error)

func (Version) String

func (v Version) String() string

func (*Version) UnmarshalControl

func (version *Version) UnmarshalControl(data string) error

Jump to

Keyboard shortcuts

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