version

package
v0.0.0-...-66e2aed Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package version provides data structures for representing version attributes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrKey

type AttrKey int8

AttrKey represents an attribute key that may be applied to an AttrSet.

Its specific values are an implementation detail of this package; only use the named constants in client code.

const (

	// Blocked indicates the version is blocked or disabled for resolution.
	// Its value is ignored; its presence is the indicator.
	//
	// In Cargo, this is equivalent to a version being "yanked".
	Blocked AttrKey = -0x01

	// Deleted indicates the version has been deleted upstream.
	// Its value is ignored; its presence is the indicator.
	Deleted AttrKey = -0x02

	// Error indicates that the version has an error when it has been fed to
	// the system (e.g. parsing, abstracting, building effective POM...)
	// This is not a resolution error, that would be stored in the resolved
	// graph, but an error during the ingestion step.
	// Its value is ignored; its presence is the indicator. The exact error
	// can be retrieved through the ingestion services (e.g. pacman, gopher...)
	Error AttrKey = -0x04

	// Redirect indicates the version has been moved to a different version or package.
	//
	// In Maven, this is equivalent to a relocation version.
	Redirect AttrKey = 1

	// Features represent clusters of optional dependencies which
	// are opted into as a set.
	//
	// In Cargo, this is a JSON map from the feature name to a list
	// of enabled dependencies/other features.
	Features AttrKey = 2

	// DerivedFrom names another package from which this version is derived.
	// The presence of this attribute implies that this version is not a primary
	// form but is rather a derivative form in some context.
	//
	// NPM uses this to link a bundled dependency to its original package.
	DerivedFrom AttrKey = 3

	// NativeLibrary specifies what native library this version links against.
	NativeLibrary AttrKey = 4

	// Registries specifies the registries where the version can be found and
	// the registries in which the dependencies can be fetched.
	// In Maven, this is a comma separated list of registry IDs, and dependency
	// registries are prefixed with "dep:".
	Registries AttrKey = 5

	// SupportedFrameworks specifies what dotnet target frameworks this
	// versions supports as a colon-separated list. Each element is the raw
	// string received from upstream.
	SupportedFrameworks AttrKey = 6

	// DependencyGroups specifies what dotnet target framework dependencies
	// the package specifies as a colon-separated list. It includes
	// dependency groups that don't have any dependencies for that
	// framework.
	DependencyGroups AttrKey = 7

	// Ident is a 16-byte UUID that uniquely identifies this immutable
	// version.
	Ident AttrKey = 8

	// Created is the time the version was created as reported upstream. The
	// value is represented as a unix timestamp in seconds encoded as
	// varint.
	Created AttrKey = 9

	// Tags is a comma separated list of other names this version is known
	// as, such as "latest" in npm.
	Tags AttrKey = 10
)

func (AttrKey) String

func (i AttrKey) String() string

type AttrSet

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

AttrSet represents a set of version attributes. The zero value of AttrSet is an empty set.

func (AttrSet) Clone

func (s AttrSet) Clone() AttrSet

Clone returns a copy of s.

func (AttrSet) Empty

func (s AttrSet) Empty() bool

Empty reports whether the AttrSet is equivalent to its zero value.

func (AttrSet) Equal

func (s AttrSet) Equal(other AttrSet) bool

func (AttrSet) ForEachAttr

func (s AttrSet) ForEachAttr(f func(key AttrKey, value string))

ForEachAttr calls f for each attribute.

func (AttrSet) GetAttr

func (s AttrSet) GetAttr(key AttrKey) (value string, ok bool)

GetAttr gets an attribute.

func (AttrSet) HasAttr

func (s AttrSet) HasAttr(key AttrKey) bool

HasAttr reports whether the set has the given attribute. This is a convenience method when the key is used as a flag.

func (*AttrSet) SetAttr

func (s *AttrSet) SetAttr(key AttrKey, value string)

SetAttr adds an attribute to the Set, replacing any existing one of the same key.

func (AttrSet) String

func (s AttrSet) String() string

Jump to

Keyboard shortcuts

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