cmd

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DB_NAME = "cmd.db"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandEvent

type CommandEvent struct {
	detect.Command
	Borg string
}

CommandEvent is published when a command running in a pane completes execution.

type DB

type DB struct {
	*sql.DB
	*cmd.Queries
}

func Create

func Create(filename string) (*DB, error)

func Open

func Open(filename string) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) CreateCommand

func (db *DB) CreateCommand(
	ctx context.Context,
	c CommandEvent,
) error

func (*DB) ListCommands

func (db *DB) ListCommands(ctx context.Context) ([]CommandEvent, error)

type Store

type Store struct {
	deadlock.RWMutex
	// contains filtered or unexported fields
}

Store coordinates the access to and creation of SQLite databases containing executed commands.

func NewStore

func NewStore() *Store

func (*Store) OpenDatabases

func (s *Store) OpenDatabases(dirs []string) error

OpenDatabases looks for cmd.db in all of the provided data directories and opens them if they exist. This method does not create new databases.

func (*Store) QueryCommands

func (s *Store) QueryCommands(ctx context.Context) ([]CommandEvent, error)

QueryCommands queries commands across all open command databases.

func (*Store) SaveCommand

func (s *Store) SaveCommand(ctx context.Context, c CommandEvent) error

SaveCommand stores a command in the command database adjacent to its borg file.

Jump to

Keyboard shortcuts

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