Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Creator ¶
type Creator struct {
// Creator is the value of the Creator relationship.
Creator string
// CreatorType is the key of the Creator relationship.
// In accordance to the SPDX v2 spec, CreatorType should be one of "Person", "Organization", or "Tool".
CreatorType string
}
Creator describes the creator of the SPDX document that will be produced from the encoding.
type Decoder ¶ added in v1.5.49
type Decoder struct {
// The data format to decode.
Format Format
// The PURL converter to use for parsing PURLs into IndexRecords.
PURLConverter purl.Converter
}
Decoder defines an SPDX decoder that converts SPDX documents to claircore.IndexReport.
func NewDefaultDecoder ¶ added in v1.5.49
func NewDefaultDecoder(options ...DecoderOption) *Decoder
NewDefaultDecoder creates a Decoder with default values and sets optional fields based on the provided options.
type DecoderOption ¶ added in v1.5.49
type DecoderOption func(*Decoder)
DecoderOption is a type for configuring a Decoder.
func WithDecoderFormat ¶ added in v1.5.49
func WithDecoderFormat(f Format) DecoderOption
WithDecoderFormat sets the format for decoding.
func WithDecoderPURLConverter ¶ added in v1.5.49
func WithDecoderPURLConverter(registry purl.Converter) DecoderOption
WithDecoderPURLConverter sets the PURL converter registry for parsing PURLs.
type Encoder ¶
type Encoder struct {
// The target SPDX version in which to encode.
Version Version
// The data format in which to encode.
Format Format
// The SPDX document creator information.
Creators []Creator
// The SPDX document name field.
DocumentName string
// The SPDX document namespace field.
DocumentNamespace string
// The SPDX document comment field.
DocumentComment string
// The PURL converter to use.
PURLConverter purl.Converter
}
Encoder defines an SPDX encoder and accepts certain values from the caller to use in the SPDX document.
func NewDefaultEncoder ¶
func NewDefaultEncoder(options ...EncoderOption) *Encoder
NewDefaultEncoder creates an Encoder with default values and sets optional fields based on the provided options.
func (*Encoder) Encode ¶
Encode encodes a claircore.IndexReport that writes to w. We first convert the IndexReport to an SPDX doc of the latest version, then convert that doc to the specified version. We assume there's no data munging going from the latest to the specified version.
type EncoderOption ¶ added in v1.5.49
type EncoderOption func(*Encoder)
EncoderOption is a type for configuring an Encoder.
func WithDocumentComment ¶
func WithDocumentComment(comment string) EncoderOption
WithDocumentComment is used to set the SPDX document comment field.
func WithDocumentName ¶
func WithDocumentName(name string) EncoderOption
WithDocumentName is used to set the SPDX document name field.
func WithDocumentNamespace ¶
func WithDocumentNamespace(namespace string) EncoderOption
WithDocumentNamespace is used to set the SPDX document namespace field.
func WithPURLConverter ¶ added in v1.5.49
func WithPURLConverter(registry purl.Converter) EncoderOption
WithPURLConverter is used to set the purl converter registry.