Documentation
¶
Overview ¶
Package db provides a database to store information about packages
Index ¶
- Variables
- type Option
- type Package
- type PackagesDB
- func (p *PackagesDB) Close() error
- func (p *PackagesDB) DeletePackage(name string) error
- func (p *PackagesDB) GetPackage(name string) (Package, error)
- func (p *PackagesDB) HasPackage(name string) (bool, error)
- func (p *PackagesDB) ListPackages() ([]Package, error)
- func (p *PackagesDB) SetPackage(pkg Package) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPackageNotFound is returned when a package is not found ErrPackageNotFound = errors.New("package not found") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
Option is a function that sets an option on a PackagesDB
func WithTimeout ¶
WithTimeout sets the timeout for opening the database
type PackagesDB ¶
type PackagesDB struct {
// contains filtered or unexported fields
}
PackagesDB is a database that stores information about packages
func New ¶
New creates a new PackagesDB. The context can be used to cancel the file lock acquisition if the database is held by another process, allowing the caller to abort instead of waiting for the bbolt timeout (or indefinitely if none is set).
func (*PackagesDB) DeletePackage ¶
func (p *PackagesDB) DeletePackage(name string) error
DeletePackage deletes a package by name
func (*PackagesDB) GetPackage ¶
func (p *PackagesDB) GetPackage(name string) (Package, error)
GetPackage returns a package by name
func (*PackagesDB) HasPackage ¶
func (p *PackagesDB) HasPackage(name string) (bool, error)
HasPackage checks if a package exists
func (*PackagesDB) ListPackages ¶
func (p *PackagesDB) ListPackages() ([]Package, error)
ListPackages returns a list of all packages
func (*PackagesDB) SetPackage ¶
func (p *PackagesDB) SetPackage(pkg Package) error
SetPackage sets a package