version

package
v0.77.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 19 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EQ  operator = "="
	GT  operator = ">"
	LT  operator = "<"
	GTE operator = ">="
	LTE operator = "<="
	OR  operator = "||"
	AND operator = ","
)

Variables

View Source
var ErrUnsupportedVersion = fmt.Errorf("unsupported version value")

ErrUnsupportedVersion is returned when a version string cannot be parsed into a rich version object for a known unsupported case (e.g. golang "devel" version).

Functions

This section is empty.

Types

type Comparator

type Comparator interface {
	Compare(*Version) (int, error)
}

type Constraint

type Constraint interface {
	fmt.Stringer
	Satisfied(*Version) (bool, error)
}

func GetConstraint

func GetConstraint(constStr string, format Format) (Constraint, error)

func MustGetConstraint

func MustGetConstraint(constStr string, format Format) Constraint

MustGetConstraint is meant for testing only, do not use within the library

type Format

type Format int
const (
	UnknownFormat Format = iota
	SemanticFormat
	ApkFormat
	DebFormat
	MavenFormat
	RpmFormat
	PythonFormat
	KBFormat
	GemFormat
	PortageFormat
	GolangFormat
)

func FormatFromPkgType

func FormatFromPkgType(t pkg.Type) Format

func ParseFormat

func ParseFormat(userStr string) Format

func (Format) String

func (f Format) String() string

type NonFatalConstraintError added in v0.20.0

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

NonFatalConstraintError should be used any time an unexpected but recoverable condition is encountered while checking version constraint satisfaction. The error should get returned by any implementer of the Constraint interface. If returned by the Satisfied method on the Constraint interface, this error will be caught and logged as a warning in the FindMatchesByPackageDistro function in grype/matcher/common/distro_matchers.go

func (NonFatalConstraintError) Error added in v0.20.0

func (e NonFatalConstraintError) Error() string

type Version

type Version struct {
	Raw    string
	Format Format
	// contains filtered or unexported fields
}

func NewVersion

func NewVersion(raw string, format Format) (*Version, error)

func NewVersionFromPkg

func NewVersionFromPkg(p pkg.Package) (*Version, error)

func (Version) CPEs

func (v Version) CPEs() []cpe.CPE

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