db

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 16 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

SuperSet binds the dependencies

Functions

func MetadataPath added in v0.6.0

func MetadataPath(cacheDir string) string

MetadataPath returns the metaData file path

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(dbc dbOperation, githubClient github.Operation, pb indicator.ProgressBar, clock clock.Clock, metadata Metadata) Client

NewClient is the factory method for DB client

func (Client) Download added in v0.2.0

func (c Client) Download(ctx context.Context, cacheDir string, light bool) error

Download downloads the DB file

func (Client) NeedsUpdate added in v0.3.0

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

NeedsUpdate check is DB needs update

func (Client) UpdateMetadata added in v0.6.0

func (c Client) UpdateMetadata(cacheDir string) error

UpdateMetadata updates the DB metadata

type Metadata added in v0.6.0

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

Metadata defines the file meta

func NewMetadata added in v0.6.0

func NewMetadata(fs afero.Fs, cacheDir string) Metadata

NewMetadata is the factory method for file Metadata

func (Metadata) Delete added in v0.6.0

func (m Metadata) Delete() error

Delete deletes the file of database metadata

func (Metadata) Get added in v0.6.0

func (m Metadata) Get() (db.Metadata, error)

Get returns the file metadata

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) ApplyUpdateMetadataExpectation added in v0.6.0

func (_m *MockOperation) ApplyUpdateMetadataExpectation(e OperationUpdateMetadataExpectation)

func (*MockOperation) ApplyUpdateMetadataExpectations added in v0.6.0

func (_m *MockOperation) ApplyUpdateMetadataExpectations(expectations []OperationUpdateMetadataExpectation)

func (*MockOperation) Download added in v0.6.0

func (_m *MockOperation) Download(ctx context.Context, cacheDir string, light bool) error

Download provides a mock function with given fields: ctx, cacheDir, light

func (*MockOperation) NeedsUpdate added in v0.6.0

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

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

func (*MockOperation) UpdateMetadata added in v0.6.0

func (_m *MockOperation) UpdateMetadata(cacheDir string) error

UpdateMetadata provides a mock function with given fields: cacheDir

type Operation added in v0.2.0

type Operation interface {
	NeedsUpdate(cliVersion string, light, skip bool) (need bool, err error)
	Download(ctx context.Context, cacheDir string, light bool) (err error)
	UpdateMetadata(cacheDir string) (err error)
}

Operation defines the DB operations

type OperationDownloadArgs added in v0.6.0

type OperationDownloadArgs struct {
	Ctx              context.Context
	CtxAnything      bool
	CacheDir         string
	CacheDirAnything bool
	Light            bool
	LightAnything    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
	Light              bool
	LightAnything      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 OperationUpdateMetadataArgs added in v0.6.0

type OperationUpdateMetadataArgs struct {
	CacheDir         string
	CacheDirAnything bool
}

type OperationUpdateMetadataExpectation added in v0.6.0

type OperationUpdateMetadataExpectation struct {
	Args    OperationUpdateMetadataArgs
	Returns OperationUpdateMetadataReturns
}

type OperationUpdateMetadataReturns added in v0.6.0

type OperationUpdateMetadataReturns struct {
	Err error
}

Jump to

Keyboard shortcuts

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