models

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EcosystemMaven     = "Maven"
	EcosystemRubyGems  = "RubyGems"
	EcosystemGo        = "Go"
	EcosystemNpm       = "npm"
	EcosystemPyPI      = "PyPI"
	EcosystemCargo     = "Cargo"
	EcosystemNuGet     = "NuGet"
	EcosystemPackagist = "Packagist"
	EcosystemHex       = "Hex"
	EcosystemPub       = "Pub"
	EcosystemCyDxSBOM  = "CycloneDxSbom"
	EcosystemSpdxSBOM  = "SpdxSbom"
)

Variables

This section is empty.

Functions

func IdGen added in v1.5.3

func IdGen(data string) string

This is probably not the best place for IdGen but keeping it here since this package is the most stable (SDP)

func NewPackageDetail

func NewPackageDetail(e, n, v string) lockfile.PackageDetails

Types

type Package

type Package struct {
	lockfile.PackageDetails `json:"package_detail"`

	// Insights obtained for this package
	Insights *insightapi.PackageVersionInsight `json:"insights,omitempty"`

	// This package is a transitive dependency of parent package
	Parent *Package `json:"-"`

	// Depth of this package in dependency tree
	Depth int `json:"depth"`

	// Manifest from where this package was found directly or indirectly
	Manifest *PackageManifest `json:"-"`
}

Represents a package such as a version of a library defined as a dependency in Gemfile.lock, pom.xml etc.

func (*Package) GetName added in v1.3.0

func (p *Package) GetName() string

func (*Package) GetSpecEcosystem added in v1.3.0

func (p *Package) GetSpecEcosystem() modelspec.Ecosystem

FIXME: For SPDX/CycloneDX, package ecosystem may be different from the manifest ecosystem

func (*Package) GetVersion added in v1.3.0

func (p *Package) GetVersion() string

func (*Package) Id

func (p *Package) Id() string

func (*Package) ShortName

func (p *Package) ShortName() string

type PackageManifest

type PackageManifest struct {
	// Filesystem path of this manifest
	Path string `json:"path"`

	// When we scan non-path entities like Github org / repo
	// then only path doesn't make sense, which is more local
	// temporary file path
	DisplayPath string `json:"display_path"`

	// Ecosystem to interpret this manifest
	Ecosystem string `json:"ecosystem"`

	// List of packages obtained by parsing the manifest
	Packages []*Package `json:"packages"`
	// contains filtered or unexported fields
}

Represents a package manifest that contains a list of packages. Example: pom.xml, requirements.txt

func (*PackageManifest) AddPackage

func (pm *PackageManifest) AddPackage(pkg *Package)

func (*PackageManifest) GetDisplayPath added in v1.3.1

func (pm *PackageManifest) GetDisplayPath() string

GetDisplayPath returns the [DisplayPath] if available or fallsback to [Path]

func (*PackageManifest) GetPackagesCount added in v1.4.0

func (pm *PackageManifest) GetPackagesCount() int

func (*PackageManifest) GetPath added in v1.3.0

func (pm *PackageManifest) GetPath() string

func (*PackageManifest) GetSpecEcosystem added in v1.3.0

func (pm *PackageManifest) GetSpecEcosystem() modelspec.Ecosystem

func (*PackageManifest) Id added in v1.3.0

func (pm *PackageManifest) Id() string

func (*PackageManifest) SetDisplayPath added in v1.3.1

func (pm *PackageManifest) SetDisplayPath(path string)

Jump to

Keyboard shortcuts

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