dao

package
v0.2.28 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAO

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

DAO abstracts away the database access

func Open

func Open(stateDir string) *DAO

Open returns a new DAO at the given state directory

func (*DAO) DeletePackage

func (d *DAO) DeletePackage(name string) error

DeletePackage removes a package from the DB

func (*DAO) Dump

func (d *DAO) Dump(w io.Writer) error

Dump content of database to w.

func (*DAO) GetKnownUsages

func (d *DAO) GetKnownUsages(name string) ([]string, error)

GetKnownUsages returns a list of bin directories where this package has been seen previously

func (*DAO) GetPackage

func (d *DAO) GetPackage(name string) (*Package, error)

GetPackage returns information of a specific package

func (*DAO) GetUnusedSince

func (d *DAO) GetUnusedSince(usedAt time.Time) ([]string, error)

GetUnusedSince return packages that have not been used since the given time

func (*DAO) PackageRemovedAt

func (d *DAO) PackageRemovedAt(name string, binDir string) error

PackageRemovedAt Removes a package installation from the DB

func (*DAO) UpdatePackage

func (d *DAO) UpdatePackage(name string, pkg *Package) error

UpdatePackage Updates the update check time, etag, and the used at time for a package

func (*DAO) UpdatePackageWithUsage

func (d *DAO) UpdatePackageWithUsage(binDir string, name string, pkg *Package) error

UpdatePackageWithUsage updates the given package and records its installation directory

type Package

type Package struct {
	UsedAt          time.Time
	Etag            string
	UpdateCheckedAt time.Time
}

Package is the package information stored in the DB

Jump to

Keyboard shortcuts

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