semver

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package semver provides semantic version parsing and constraint checking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constraint

type Constraint struct {
	// contains filtered or unexported fields
}

Constraint represents a version constraint

func NewConstraint

func NewConstraint(c string) (Constraint, error)

NewConstraint parses a constraint string Supports: >=, <=, >, <, =, ^, ~, and ranges like ">=1.0.0 <2.0.0"

func (Constraint) Check

func (c Constraint) Check(v Version) bool

Check returns true if the version satisfies all constraints

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version represents a semantic version

func NewVersion

func NewVersion(v string) (Version, error)

NewVersion parses a string into a Version

func (Version) Compare

func (v Version) Compare(other Version) int

Compare returns -1 if v < other, 0 if v == other, 1 if v > other

func (Version) Major

func (v Version) Major() int

Major returns the major version number

func (Version) Minor

func (v Version) Minor() int

Minor returns the minor version number

func (Version) Patch

func (v Version) Patch() int

Patch returns the patch version number

func (Version) String

func (v Version) String() string

String returns the original version string

Jump to

Keyboard shortcuts

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