versions

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package versions provides helpful methods for anything related to the versions in eclectica

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Complete

func Complete(version string, vers []string) (string, error)

Complete completes the version to semver in case provided value is incomplete

func Compose

func Compose(versions []string) map[string][]string

Compose versions to map object of arrays from array

func ComposeMajors

func ComposeMajors(versions []string) map[string][]string

ComposeMajors majors version to map object of arrays from array

func ComposeMinors

func ComposeMinors(versions []string) map[string][]string

ComposeMinors composes minor version to map object of arrays from array

func GetElements

func GetElements(key string, versions map[string][]string) []string

GetElements gets all elements for provided range of version in sorted semver format:

  map[string][]string{
		"1.x": string{1.1, 1.1-beta}
	}

Will return:

[1.1.0, 1.1.0-beta]

func GetKeys

func GetKeys(versions map[string][]string) []string

GetKeys returns array of keys

map[string][]string{"4.x": []string{}, "0.x": []string{"0.8.2"}}

gets you:

string{"0.x", "4.x"}

func HasMinor

func HasMinor(version string) bool

HasMinor checks if provided version has minor info in it

func HasOnlyMajor

func HasOnlyMajor(version string) bool

HasOnlyMajor checks if provided version has only major number in it

func IsPartial

func IsPartial(version string) bool

IsPartial checks if provided version is not full semver version

func Latest

func Latest(version string, versions []string) (string, error)

Latest returns latest version from provided list "1.x" with [1.1.0, 1.1.1-beta, 1.1.1-rc2, 1.0, 1.1.1] will return "1.1.1", same for "latest" with [1.1.0, 1.1.1-beta, 1.1.1-rc2, 1.0, 1.1.1]

func Semverify

func Semverify(version string) string

Semverify will do its best to semverify a string "1.8-beta2" -> "1.8.0-beta2"

func Unsemverify

func Unsemverify(version string) string

Unsemverify will do its best to unsemverify a string "1.8.0-beta2" -> "1.8-beta2"

Types

This section is empty.

Jump to

Keyboard shortcuts

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