package spdxlib
import "github.com/spdx/tools-golang/spdxlib"
Package spdxlib contains convenience and utility functions for working with an SPDX document that has already been created in memory. SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Index ¶
- func FilterRelationships2_1(doc *spdx.Document2_1, filter func(*spdx.Relationship2_1) *spdx.ElementID) ([]spdx.ElementID, error)
- func FilterRelationships2_2(doc *spdx.Document2_2, filter func(*spdx.Relationship2_2) *spdx.ElementID) ([]spdx.ElementID, error)
- func GetDescribedPackageIDs2_1(doc *spdx.Document2_1) ([]spdx.ElementID, error)
- func GetDescribedPackageIDs2_2(doc *spdx.Document2_2) ([]spdx.ElementID, error)
- func SortElementIDs(eIDs []spdx.ElementID) []spdx.ElementID
- func ValidateDocument2_1(doc *spdx.Document2_1) error
- func ValidateDocument2_2(doc *spdx.Document2_2) error
Functions ¶
func FilterRelationships2_1 ¶
func FilterRelationships2_1(doc *spdx.Document2_1, filter func(*spdx.Relationship2_1) *spdx.ElementID) ([]spdx.ElementID, error)
FilterRelationships2_1 returns a slice of Element IDs returned by the given filter closure. The closure is passed one relationship at a time, and it can return an ElementID or nil.
func FilterRelationships2_2 ¶
func FilterRelationships2_2(doc *spdx.Document2_2, filter func(*spdx.Relationship2_2) *spdx.ElementID) ([]spdx.ElementID, error)
FilterRelationships2_2 returns a slice of Element IDs returned by the given filter closure. The closure is passed one relationship at a time, and it can return an ElementID or nil.
func GetDescribedPackageIDs2_1 ¶
func GetDescribedPackageIDs2_1(doc *spdx.Document2_1) ([]spdx.ElementID, error)
GetDescribedPackageIDs2_1 returns a slice of ElementIDs for all Packages in this Document that it "describes," according to SPDX rules:
- If the document has only one Package, its ID is returned.
- If the document has 2+ Packages, it returns the IDs of those that have a DESCRIBES (or DESCRIBED_BY) relationship to this DOCUMENT.
func GetDescribedPackageIDs2_2 ¶
func GetDescribedPackageIDs2_2(doc *spdx.Document2_2) ([]spdx.ElementID, error)
GetDescribedPackageIDs2_2 returns a slice of ElementIDs for all Packages in this Document that it "describes," according to SPDX rules:
- If the document has only one Package, its ID is returned.
- If the document has 2+ Packages, it returns the IDs of those that have a DESCRIBES (or DESCRIBED_BY) relationship to this DOCUMENT.
func SortElementIDs ¶
SortElementIDs sorts and returns the given slice of ElementIDs
func ValidateDocument2_1 ¶
func ValidateDocument2_1(doc *spdx.Document2_1) error
ValidateDocument2_1 returns an error if the Document is found to be invalid, or nil if the Document is valid. Currently, this only verifies that all Element IDs mentioned in Relationships exist in the Document as either a Package or an UnpackagedFile.
func ValidateDocument2_2 ¶
func ValidateDocument2_2(doc *spdx.Document2_2) error
ValidateDocument2_2 returns an error if the Document is found to be invalid, or nil if the Document is valid. Currently, this only verifies that all Element IDs mentioned in Relationships exist in the Document as either a Package or an UnpackagedFile.
Source Files ¶
described_elements.go documents.go element_ids.go relationships.go
- Version
- v0.3.0-rc1
- Published
- Mar 27, 2022
- Platform
- js/wasm
- Imports
- 3 packages
- Last checked
- 4 hours ago –
Tools for package owners.