semver

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package semver provides a model and functions for working with semantic versions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Version

type Version struct {
	Major, Minor, Patch int
}

Version represents a very simple semantic version that consists of three parts: major, minor, and patch and represents them separated by periods.

func New

func New(major, minor, patch int) *Version

New returns a new Version with the specified major, minor, and patch components

func Parse

func Parse(version string) *Version

Parse parses a version from a string. It matches a very simple regexp in the string and is very lenient. If no version text found, the version will be 0.0.0.

func (*Version) Compare

func (v *Version) Compare(o *Version) int

Compare returns a value less than 0 if v1 < v2, 0 if v1 == v2, and greater than 0 if v1 > v2

func (*Version) Equals

func (v *Version) Equals(o *Version) bool

Equals returns true if v is equal to o

func (*Version) IsNewer

func (v *Version) IsNewer(o *Version) bool

IsNewer returns true if v is newer than o

func (*Version) IsOlder

func (v *Version) IsOlder(o *Version) bool

IsOlder returns true if v is older than o

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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