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 ¶
View Source
var ( // ErrPackageNotFound is returned when a package is not found ErrPackageNotFound = fmt.Errorf("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 ¶
func New(dbPath string, opts ...Option) (*PackagesDB, error)
New creates a new PackagesDB
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
Click to show internal directories.
Click to hide internal directories.