writer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFormatSerializer added in v0.2.0

func GetFormatSerializer(format formats.Format) (native.Serializer, error)

GetFormatSerializer returns the registered serializer for a specific format. If format is a blank string or no serializer for the format is registered, it will return an error.

func RegisterSerializer added in v0.2.0

func RegisterSerializer(format formats.Format, s native.Serializer)

RegisterSerializer registers a new serializer to handle writing serialized SBOMs in a specific format. When registerring a new serializer it replaces any other previously defined for the same format.

func UnregisterSerializer added in v0.2.0

func UnregisterSerializer(format formats.Format)

UnregisterSerializer removes a serializer from the list of available

Types

type Options added in v0.2.0

type Options struct {
	Format           formats.Format
	RenderOptions    *native.RenderOptions
	SerializeOptions *native.SerializeOptions
	// contains filtered or unexported fields
}

func (*Options) GetFormatOptions added in v0.2.0

func (o *Options) GetFormatOptions(key interface{}) interface{}

func (*Options) SetFormatOptions added in v0.2.0

func (o *Options) SetFormatOptions(key, opts interface{})

type Writer

type Writer struct {
	Options *Options
}

func New

func New(opts ...WriterOption) *Writer

func (*Writer) WriteFile

func (w *Writer) WriteFile(bom *sbom.Document, path string) error

WriteFile

func (*Writer) WriteFileWithOptions added in v0.2.0

func (w *Writer) WriteFileWithOptions(bom *sbom.Document, path string, o *Options) error

WriteFile takes an sbom.Document and writes it to the file at path

func (*Writer) WriteStream

func (w *Writer) WriteStream(bom *sbom.Document, wr io.WriteCloser) error

func (*Writer) WriteStreamWithOptions added in v0.2.0

func (w *Writer) WriteStreamWithOptions(bom *sbom.Document, wr io.WriteCloser, o *Options) error

WriteStreamWithOptions writes an SBOM in a native format to the stream w using the options set o.

type WriterOption added in v0.2.0

type WriterOption func(*Writer)

func WithFormat added in v0.2.0

func WithFormat(f formats.Format) WriterOption

func WithFormatOptions added in v0.2.0

func WithFormatOptions(driverKey string, opts interface{}) WriterOption

func WithRenderOptions added in v0.2.0

func WithRenderOptions(ro *native.RenderOptions) WriterOption

func WithSerializeOptions added in v0.2.0

func WithSerializeOptions(so *native.SerializeOptions) WriterOption

Jump to

Keyboard shortcuts

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