db

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound error = errors.New("query returned no results")
)

Functions

func Modified

func Modified(p string) error

Modified notifies the database at path p that its content has been updated.

Types

type DB

type DB struct {
	Root string
	// contains filtered or unexported fields
}

func New

func New(root, assetEndpoint string) (*DB, error)

func (*DB) Empty

func (db *DB) Empty() bool

Empty returns true if the database has no entries, otherwise false.

func (*DB) FindByExtensionID added in v1.0.2

func (db *DB) FindByExtensionID(keepLatestVersion bool, ids ...string) []vscode.Extension

func (*DB) FindByUniqueID

func (db *DB) FindByUniqueID(keepLatestVersion bool, uniqueIDs ...string) []vscode.Extension

FindByUniqueID returns an array of extensions matching a list of uniqueID's. If keepLatestVersion is true only the latest version is keep of all available version for returned extensions. When false all versions for an extension are included.

func (*DB) Inconsistent

func (db *DB) Inconsistent() (bool, error)

Inconsistent returns true if the database in memory is inconsistent with files on disk. Currently it only checks if version folders have been modified since the last database load.

func (*DB) List

func (db *DB) List() []vscode.Extension

List return all entries in the database.

func (*DB) Reload

func (db *DB) Reload() error

func (*DB) Search

func (db *DB) Search(keepLatestVersion bool, text ...string) []vscode.Extension

func (*DB) Stats

func (db *DB) Stats() DBStats

Stats return some statistics about the database.

func (*DB) String

func (db *DB) String() string

String dumps the entire database as a JSON string.

type DBStats

type DBStats struct {
	ExtensionCount int
	VersionCount   int
	// time it took to load the database from disk
	LoadDuration time.Duration
}

Jump to

Keyboard shortcuts

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