semver

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 3 Imported by: 0

README

Semver Version Compare

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/semver

Getting Started

func TestIsGreatThan(t *testing.T) {
	res, _ := IsGreatThan("v2.0.0", "v1.0.0")
	testify.Assert(t, res, "v2.0.0 should be greater than v1.0.0")

	res, _ = IsGreatThan("v2.1.0", "v2.0.0")
	testify.Assert(t, res, "v2.1.0 should not be greater than v2.0.0")

	res, _ = IsGreatThan("v2.0.1", "v2.0.0")
	testify.Assert(t, res, "v2.0.1 should not be greater than v2.0.0")

	res, _ = IsGreatThan("v2.0.0", "v2.0.0")
	testify.Assert(t, !res, "v2.0.0 should not be greater than v2.0.0")

	res, _ = IsGreatThan("v1.0.0", "v2.0.0")
	testify.Assert(t, !res, "v1.0.0 should not be greater than v2.0.0")
}

License

GoZoox is released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "1.0.1"

Version is the current version of cron.

Functions

func IsEqual

func IsEqual(v1, v2 string) bool

IsEqual returns true if v1 and v2 are equal.

func IsGreatThan

func IsGreatThan(v1, v2 string) (bool, error)

IsGreatThan returns true if v1 is greater than v2.

func IsGreatThanOrEqual

func IsGreatThanOrEqual(v1, v2 string) (bool, error)

IsGreatThanOrEqual returns true if v1 is greater than or equal to v2.

func IsLittleThan

func IsLittleThan(v1, v2 string) (bool, error)

IsLittleThan returns true if v1 is less than v2.

func IsLittleThanOrEqual

func IsLittleThanOrEqual(v1, v2 string) (bool, error)

IsLittleThanOrEqual returns true if v1 is less than or equal to v2.

Types

This section is empty.

Jump to

Keyboard shortcuts

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