store

package
v0.0.0-...-7dd06bf Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2015 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScoreIncrement = 10
)

Variables

View Source
var (
	ErrEmptyHOME = errors.New("environment variable HOME is empty")
)
View Source
var ErrNoMatchingCmd = errors.New("no matching command line")

Functions

func DefaultDB

func DefaultDB(dataDir string) (*sql.DB, error)

DefaultDB returns the default database for storage.

func EnsureDataDir

func EnsureDataDir() (string, error)

EnsureDataDir ensures Elvish's data directory exists, creating it if necessary. It returns the path to the data directory (never with a trailing slash) and possible error.

Types

type Dir

type Dir struct {
	Path  string
	Score float64
}

type Store

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

func NewStore

func NewStore(dataDir string) (*Store, error)

NewStore creates a new Store with the default database.

func NewStoreDB

func NewStoreDB(db *sql.DB) (*Store, error)

NewStoreDB creates a new Store with a custom database. The database must be a SQLite database.

func (*Store) AddCmd

func (s *Store) AddCmd(cmd string) error

func (*Store) AddDir

func (s *Store) AddDir(d string) error

func (*Store) Cmd

func (s *Store) Cmd(seq int) (string, error)

func (*Store) FindDirs

func (s *Store) FindDirs(p string) ([]Dir, error)

func (*Store) FirstCmd

func (s *Store) FirstCmd(from int, prefix string) (int, string, error)

func (*Store) LastCmd

func (s *Store) LastCmd(upto int, prefix string) (int, string, error)

func (*Store) ListDirs

func (s *Store) ListDirs() ([]Dir, error)

func (*Store) NextCmdSeq

func (s *Store) NextCmdSeq() (int, error)

Jump to

Keyboard shortcuts

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