purl

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 3 Imported by: 2

Documentation

Overview

Package purl provides functions to code and decode package url according to the spec: https://github.com/package-url/purl-spec This package is a convenience wrapper and abstraction layer around an existing open source implementation.

Index

Constants

View Source
const (
	// TypeAlpm is a pkg:alpm purl.
	TypeAlpm = "alpm"
	// TypeApk is a pkg:apk purl.
	TypeApk = "apk"
	// TypeBitbucket is a pkg:bitbucket purl.
	TypeBitbucket = "bitbucket"
	// TypeBrew is a pkg:brew purl.
	TypeBrew = "brew"
	// TypeCocoapods is a pkg:cocoapods purl.
	TypeCocoapods = "cocoapods"
	// TypeCargo is a pkg:cargo purl.
	TypeCargo = "cargo"
	// TypeComposer is a pkg:composer purl.
	TypeComposer = "composer"
	// TypeConan is a pkg:conan purl.
	TypeConan = "conan"
	// TypeConda is a pkg:conda purl.
	TypeConda = "conda"
	// TypeCOS is the pkg:cos purl
	TypeCOS = "cos"
	// TypeCran is a pkg:cran purl.
	TypeCran = "cran"
	// TypeDebian is a pkg:deb purl.
	TypeDebian = "deb"
	// TypeDocker is a pkg:docker purl.
	TypeDocker = "docker"
	// TypeK8s is a pkg:k8s purl.
	TypeK8s = "k8s"
	// TypeFlatpak is a pkg:flatpak purl.
	TypeFlatpak = "flatpak"
	// TypeGem is a pkg:gem purl.
	TypeGem = "gem"
	// TypeGeneric is a pkg:generic purl.
	TypeGeneric = "generic"
	// TypeGithub is a pkg:github purl.
	TypeGithub = "github"
	// TypeGolang is a pkg:golang purl.
	TypeGolang = "golang"
	// TypeHackage is a pkg:hackage purl.
	TypeHackage = "hackage"
	// TypeHaskell is a pkg:haskell purl.
	TypeHaskell = "haskell"
	// TypeMacApps is a pkg:macapps purl.
	TypeMacApps = "macapps"
	// TypeHex is a pkg:hex purl.
	TypeHex = "hex"
	// TypeMaven is a pkg:maven purl.
	TypeMaven = "maven"
	// TypeNix is a pkg:nix purl.
	TypeNix = "nix"
	// TypeNPM is a pkg:npm purl.
	TypeNPM = "npm"
	// TypePacman is a pkg:pacman purl.
	TypePacman = "pacman"
	// TypeNuget is a pkg:nuget purl.
	TypeNuget = "nuget"
	// TypeOCI is a pkg:oci purl
	TypeOCI = "oci"
	// TypeOpkg is a pkg:opkg purl.
	TypeOpkg = "opkg"
	// TypePub is a pkg:pub purl.
	TypePub = "pub"
	// TypePortage is a pkg:portage purl.
	TypePortage = "portage"
	// TypePyPi is a pkg:pypi purl.
	TypePyPi = "pypi"
	// TypeRPM is a pkg:rpm purl.
	TypeRPM = "rpm"
	// TypeSnap is a pkg:snap purl.
	TypeSnap = "snap"
	// TypeSwift is pkg:swift purl
	TypeSwift = "swift"
	// TypeGooget is pkg:googet purl
	TypeGooget = "googet"
	// TypeWordpress is pkg:wordpress purl
	TypeWordpress = "wordpress"
	// TypeAsdf is pkg:asdf purl
	TypeAsdf = "asdf"
	// TypeMise is pkg:mise purl
	TypeMise = "mise"
	// TypeMacports is pkg:macports purl
	TypeMacports = "macports"
	// TypeWinget is pkg:winget purl
	TypeWinget = "winget"
	// TypeNim is pkg:nim purl
	TypeNim = "nim"
	// TypeLua is pkg:lua purl
	TypeLua = "lua"
	// TypeChocolatey is pkg:chocolatey purl
	TypeChocolatey = "chocolatey"
)

These are the known purl types as defined in the spec. Some of these require special treatment during parsing. https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst

View Source
const (
	Distro              = "distro"
	Epoch               = "epoch"
	Arch                = "arch"
	Origin              = "origin"
	Source              = "source"
	SourceVersion       = "sourceversion"
	SourceRPM           = "sourcerpm"
	BuildNumber         = "buildnumber"
	PackageDependencies = "packagedependencies"
	Classifier          = "classifier" // Maven specific qualifier
	Type                = "type"       // Maven specific qualifier
)

Qualifier names.

Variables

This section is empty.

Functions

This section is empty.

Types

type PackageURL

type PackageURL struct {
	Type       string
	Namespace  string
	Name       string
	Version    string
	Qualifiers Qualifiers
	Subpath    string
}

PackageURL is the struct representation of the parts that make a package url.

func FromString

func FromString(purl string) (PackageURL, error)

FromString parses a valid package url string into a PackageURL structure.

func (PackageURL) String

func (p PackageURL) String() string

type Qualifier

type Qualifier packageurl.Qualifier

Qualifier represents a single key=value qualifier in the package url.

type Qualifiers

type Qualifiers packageurl.Qualifiers

Qualifiers is a slice of key=value pairs, with order preserved as it appears in the package URL.

func QualifiersFromMap

func QualifiersFromMap(mm map[string]string) Qualifiers

QualifiersFromMap constructs a Qualifiers slice from a string map. To get a deterministic qualifier order (despite maps not providing any iteration order guarantees) the returned Qualifiers are sorted in increasing order of key.

Directories

Path Synopsis
Package purlproto provides functions for converting PURL structs to and from protos.
Package purlproto provides functions for converting PURL structs to and from protos.

Jump to

Keyboard shortcuts

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