advisor

package
v0.0.0-...-115137c Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpCommands

func DumpCommands() (map[string]string, error)

DumpCommands returns the whole database as a map. For use in testing and debugging.

func ReplaceCommandsFinder

func ReplaceCommandsFinder(constructor func() (Finder, error)) (restore func())

Types

type Command

type Command struct {
	Snap    string
	Version string `json:"Version,omitempty"`
	Command string
}

func FindCommand

func FindCommand(command string) ([]Command, error)

func FindMisspelledCommand

func FindMisspelledCommand(command string) ([]Command, error)

type CommandDB

type CommandDB interface {
	// AddSnap adds the entries for commands pointing to the given
	// snap name to the commands database.
	AddSnap(snapName, version, summary string, commands []string) error
	// Commit persist the changes, and closes the database. If the
	// database has already been committed/rollbacked, does nothing.
	Commit() error
	// Rollback aborts the changes, and closes the database. If the
	// database has already been committed/rollbacked, does nothing.
	Rollback() error
}

func Create

func Create() (CommandDB, error)

Create opens the commands database for writing, and starts a transaction that drops and recreates the buckets. You should then call AddSnap with each snap you wish to add, and them Commit the results to make the changes live, or Rollback to abort; either of these closes the database again.

type Finder

type Finder interface {
	FindCommand(command string) ([]Command, error)
	FindPackage(pkgName string) (*Package, error)
	Close() error
}

func Open

func Open() (Finder, error)

Open the database for reading.

type Package

type Package struct {
	Snap    string `json:"snap"`
	Version string `json:"version"`
	Summary string `json:"summary,omitempty"`
}

func FindPackage

func FindPackage(pkgName string) (*Package, error)

Jump to

Keyboard shortcuts

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