storage

package
v0.0.0-...-ac18e30 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDBPath

func GetDBPath() (string, error)

GetDBPath returns the path to the SQLite database file

Types

type DB

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

DB handles database operations

func NewDB

func NewDB() (*DB, error)

NewDB creates a new database connection

func (*DB) AddHistoryEntry

func (db *DB) AddHistoryEntry(
	prompt string,
	response *model.CommandResponse,
	usage *model.LLMUsage,
	errorMsg string,
	parentID sql.NullInt64,
) (int64, error)

AddHistoryEntry adds a new entry to the command history

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection

func (*DB) DeleteHistoryEntry

func (db *DB) DeleteHistoryEntry(id int64) error

DeleteHistoryEntry deletes a history entry by ID

func (*DB) GetHistoryEntries

func (db *DB) GetHistoryEntries(limit int, offset int, onlyFavorites bool, searchTerm string) ([]model.HistoryEntry, error)

GetHistoryEntries retrieves entries from the command history with optional filtering

func (*DB) GetHistoryEntry

func (db *DB) GetHistoryEntry(id int64) (*model.HistoryEntry, error)

GetHistoryEntry retrieves a single history entry by ID

func (*DB) GetMostRecentSuccessfulCommand

func (db *DB) GetMostRecentSuccessfulCommand() (*model.HistoryEntry, error)

GetMostRecentSuccessfulCommand returns the last successful command

func (*DB) InitSchema

func (db *DB) InitSchema() error

InitSchema initializes the database schema

func (*DB) SearchHistory

func (db *DB) SearchHistory(query string, limit int) ([]model.HistoryEntry, error)

SearchHistory searches through history entries

func (*DB) SetFavorite

func (db *DB) SetFavorite(id int64, favorite bool) error

SetFavorite marks or unmarks a history entry as favorite

Jump to

Keyboard shortcuts

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