resultstore

package
v0.0.0-...-892e02c Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

func ConstructPath

func ConstructPath() Option

ConstructPath will cause Save() to append a suffix to the base path based on Pkg.EcosystemName() and Pkg.Name().

type Pkg

type Pkg interface {
	Name() string
	Version() string
	EcosystemName() string
}

Pkg describes the various package details used to populate the package part of the analysis results.

type ResultStore

type ResultStore struct {
	// contains filtered or unexported fields
}

func New

func New(bucket string, options ...Option) *ResultStore

New creates a new ResultStore instance with the given bucket URL and options. If the bucket URL is invalid, a nil pointer is returned.

func (*ResultStore) Save

func (rs *ResultStore) Save(ctx context.Context, p Pkg, analysis interface{}) error

Save marshals the given analysis results to JSON and writes them to the bucket with a default filename (key). If p is non-nil and has a version specified, the default filename is <version>.json. Otherwise, it is "results.json".

func (*ResultStore) SaveAnalyzedPackage

func (rs *ResultStore) SaveAnalyzedPackage(ctx context.Context, manager *pkgmanager.PkgManager, pkg Pkg) error

func (*ResultStore) SaveTempFilesToZip

func (rs *ResultStore) SaveTempFilesToZip(ctx context.Context, p Pkg, zipName string, tempFileNames []string) error

func (*ResultStore) SaveWithFilename

func (rs *ResultStore) SaveWithFilename(ctx context.Context, p Pkg, filename string, analysis any) error

SaveWithFilename saves results to the bucket with the given filename

func (*ResultStore) String

func (rs *ResultStore) String() string

Jump to

Keyboard shortcuts

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