store

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandStore

type CommandStore interface {
	// Store stores the passed commands map.
	Store(cmds map[string]string) error
	// Load retrieves a stored commands map or
	// an empty map, if no store was applied
	// before.
	Load() (cmds map[string]string, err error)
}

CommandStore allows to store and load registered commands so that they can be updated instead of deleted and re-created on restarts.

type LocalCommandStore

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

LocalCommandStore implements CommandStore for a local file as storage device.

func NewDefault

func NewDefault() *LocalCommandStore

NewDefault returns a new LocalCommandStore with default file location (".commandCache.json").

func NewLocalCommandStore

func NewLocalCommandStore(loc string) *LocalCommandStore

NewLocalCommandStore creates a new instance of LocalCommandStore with the passed file location as stoage destination.

func (*LocalCommandStore) Load

func (lcs *LocalCommandStore) Load() (cmds map[string]string, err error)

func (*LocalCommandStore) Store

func (lcs *LocalCommandStore) Store(cmds map[string]string) (err error)

Jump to

Keyboard shortcuts

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