db

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 7

Documentation

Index

Constants

View Source
const (
	SchemaVersion = db.SchemaVersion
)

Variables

View Source
var (
	DefaultRepository = fmt.Sprintf("%s:%d", "ghcr.io/aquasecurity/trivy-db", db.SchemaVersion)
)

Functions

This section is empty.

Types

type Client added in v0.2.0

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

Client implements DB operations

func NewClient added in v0.2.0

func NewClient(cacheDir string, quiet bool, opts ...Option) *Client

NewClient is the factory method for DB client

func (*Client) Download added in v0.2.0

func (c *Client) Download(ctx context.Context, dst string, opt types.RegistryOptions) error

Download downloads the DB file

func (*Client) NeedsUpdate added in v0.3.0

func (c *Client) NeedsUpdate(cliVersion string, skip bool) (bool, error)

NeedsUpdate check is DB needs update

type MockOperation added in v0.6.0

type MockOperation struct {
	mock.Mock
}

MockOperation is an autogenerated mock type for the Operation type

func (*MockOperation) ApplyDownloadExpectation added in v0.6.0

func (_m *MockOperation) ApplyDownloadExpectation(e OperationDownloadExpectation)

func (*MockOperation) ApplyDownloadExpectations added in v0.6.0

func (_m *MockOperation) ApplyDownloadExpectations(expectations []OperationDownloadExpectation)

func (*MockOperation) ApplyNeedsUpdateExpectation added in v0.6.0

func (_m *MockOperation) ApplyNeedsUpdateExpectation(e OperationNeedsUpdateExpectation)

func (*MockOperation) ApplyNeedsUpdateExpectations added in v0.6.0

func (_m *MockOperation) ApplyNeedsUpdateExpectations(expectations []OperationNeedsUpdateExpectation)

func (*MockOperation) Download added in v0.6.0

func (_m *MockOperation) Download(ctx context.Context, dst string, opt types.RegistryOptions) error

Download provides a mock function with given fields: ctx, dst

func (*MockOperation) NeedsUpdate added in v0.6.0

func (_m *MockOperation) NeedsUpdate(cliVersion string, skip bool) (bool, error)

NeedsUpdate provides a mock function with given fields: cliVersion, skip

type Operation added in v0.2.0

type Operation interface {
	NeedsUpdate(cliVersion string, skip bool) (need bool, err error)
	Download(ctx context.Context, dst string, opt types.RegistryOptions) (err error)
}

Operation defines the DB operations

type OperationDownloadArgs added in v0.6.0

type OperationDownloadArgs struct {
	Ctx         context.Context
	CtxAnything bool
	Dst         string
	DstAnything bool
}

type OperationDownloadExpectation added in v0.6.0

type OperationDownloadExpectation struct {
	Args    OperationDownloadArgs
	Returns OperationDownloadReturns
}

type OperationDownloadReturns added in v0.6.0

type OperationDownloadReturns struct {
	Err error
}

type OperationNeedsUpdateArgs added in v0.6.0

type OperationNeedsUpdateArgs struct {
	CliVersion         string
	CliVersionAnything bool
	Skip               bool
	SkipAnything       bool
}

type OperationNeedsUpdateExpectation added in v0.6.0

type OperationNeedsUpdateExpectation struct {
	Args    OperationNeedsUpdateArgs
	Returns OperationNeedsUpdateReturns
}

type OperationNeedsUpdateReturns added in v0.6.0

type OperationNeedsUpdateReturns struct {
	Need bool
	Err  error
}

type Option added in v0.23.0

type Option func(*options)

Option is a functional option

func WithClock added in v0.23.0

func WithClock(c clock.Clock) Option

WithClock takes a clock

func WithDBRepository added in v0.25.1

func WithDBRepository(dbRepository name.Reference) Option

WithDBRepository takes a dbRepository

func WithOCIArtifact added in v0.23.0

func WithOCIArtifact(art *oci.Artifact) Option

WithOCIArtifact takes an OCI artifact

Jump to

Keyboard shortcuts

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