Documentation
¶
Index ¶
- func NewHistoryCommandHandler(historyManager *HistoryManager) func(next interp.ExecHandlerFunc) interp.ExecHandlerFunc
- type HistoryEntry
- type HistoryManager
- func (historyManager *HistoryManager) Close() error
- func (historyManager *HistoryManager) DeleteEntry(id uint) error
- func (historyManager *HistoryManager) FinishCommand(entry *HistoryEntry, exitCode int) (*HistoryEntry, error)
- func (historyManager *HistoryManager) GetAllEntries() ([]HistoryEntry, error)
- func (historyManager *HistoryManager) GetDB() *gorm.DB
- func (historyManager *HistoryManager) GetEntriesSince(since time.Time) ([]HistoryEntry, error)
- func (historyManager *HistoryManager) GetRecentEntries(directory string, limit int) ([]HistoryEntry, error)
- func (historyManager *HistoryManager) GetRecentEntriesByPrefix(prefix string, limit int) ([]HistoryEntry, error)
- func (historyManager *HistoryManager) ResetHistory() error
- func (historyManager *HistoryManager) StartCommand(command string, directory string, sessionID string) (*HistoryEntry, error)
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)
Click to show internal directories.
Click to hide internal directories.