version

package
v0.0.0-...-2b6c84e Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

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

Variables

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
	RpmFormat
	PythonFormat
	KBFormat
	GemFormat
	PortageFormat
)

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

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 griffon/matcher/common/distro_matchers.go

func (NonFatalConstraintError) Error

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