version

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_MAJOR = 20
	MAX_MINOR = 50
	MAX_PATCH = 50
)

Variables

This section is empty.

Functions

func ApplyDynamicStrategy

func ApplyDynamicStrategy(targetVersion, existingVersion string) (string, error)

func ApplyRangeStrategy added in v0.1.3

func ApplyRangeStrategy(targetVersion, existingVersion string) (string, error)

func ApplyVersionStrategy

func ApplyVersionStrategy(strategy Strategy, targetVersion string, existingVersion string) (string, error)

ApplyVersionStrategy applies the specified strategy to convert between version formats

func ConvertToExactVersion

func ConvertToExactVersion(version string) (string, error)

func ConvertToRangeVersion

func ConvertToRangeVersion(version string) (string, error)

func DecideVersionOrRange

func DecideVersionOrRange(
	oldIsVer bool,
	oldVer *semver.Version,
	oldRange *semver.Constraints,
	oldInput string,
	newIsVer bool,
	newVer *semver.Version,
	newRange *semver.Constraints,
	newInput string,
) string

DecideVersionOrRange does "keep old if it fits new, otherwise new."

func ExpandTerraformTildeArrow

func ExpandTerraformTildeArrow(version string) string

ExpandTerraformTildeArrow scans for "~>" => ">=X.Y.Z,<X+1.0.0"

func NormalizeVersionString added in v0.1.2

func NormalizeVersionString(version string) string

NormalizeVersionString ensures consistent formatting of version strings

func ParseVersionOrRange

func ParseVersionOrRange(input string) (bool, *semver.Version, *semver.Constraints, error)

ParseVersionOrRange tries single version (e.g. "1.2.3") first; if that fails, tries a range with "~>" expansions.

func RangesOverlap

func RangesOverlap(a, b *semver.Constraints) bool

RangesOverlap tries some sample versions from 0.0.0..(MAX_MAJOR,MAX_MINOR,MAX_PATCH).

Types

type Strategy

type Strategy string
const (
	StrategyDynamic Strategy = "dynamic"
	StrategyExact   Strategy = "exact"
	StrategyRange   Strategy = "range"
)

Jump to

Keyboard shortcuts

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