history

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHistoryCommandHandler

func NewHistoryCommandHandler(historyManager *HistoryManager) func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc

Types

type HistoryEntry

type HistoryEntry struct {
	ID        uint      `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"index;index:idx_dir_created,priority:2"`
	UpdatedAt time.Time `gorm:"index"`

	Command   string `gorm:"index"`
	Directory string `gorm:"index:idx_dir_created,priority:1"`
	SessionID string `gorm:"index"`
	ExitCode  sql.NullInt32
}

type HistoryManager

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

func NewHistoryManager

func NewHistoryManager(dbFilePath string) (*HistoryManager, error)

func (*HistoryManager) Close

func (historyManager *HistoryManager) Close() error

Close closes the database connection. This should be called when the HistoryManager is no longer needed, especially in tests to allow cleanup of temporary database files on Windows.

func (*HistoryManager) DeleteEntry

func (historyManager *HistoryManager) DeleteEntry(id uint) error

func (*HistoryManager) FinishCommand

func (historyManager *HistoryManager) FinishCommand(entry *HistoryEntry, exitCode int) (*HistoryEntry, error)

func (*HistoryManager) GetAllEntries

func (historyManager *HistoryManager) GetAllEntries() ([]HistoryEntry, error)

GetAllEntries returns all history entries ordered by creation time (newest first)

func (*HistoryManager) GetDB

func (historyManager *HistoryManager) GetDB() *gorm.DB

GetDB returns the underlying GORM database connection. This allows other packages (like coach) to use the same database.

func (*HistoryManager) GetEntriesSince

func (historyManager *HistoryManager) GetEntriesSince(since time.Time) ([]HistoryEntry, error)

GetEntriesSince returns all history entries created after the given time, ordered by creation time (oldest first)

func (*HistoryManager) GetRecentEntries

func (historyManager *HistoryManager) GetRecentEntries(directory string, limit int) ([]HistoryEntry, error)

func (*HistoryManager) GetRecentEntriesByPrefix

func (historyManager *HistoryManager) GetRecentEntriesByPrefix(prefix string, limit int) ([]HistoryEntry, error)

func (*HistoryManager) ResetHistory

func (historyManager *HistoryManager) ResetHistory() error

func (*HistoryManager) StartCommand

func (historyManager *HistoryManager) StartCommand(command string, directory string, sessionID string) (*HistoryEntry, error)

Jump to

Keyboard shortcuts

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