Documentation
¶
Overview ¶
Package storage provides database operations for conversations, messages, and metadata. ABOUTME: Conversation CRUD operations for SQLite storage ABOUTME: Create, read, update, delete, and list conversations
Package storage provides database operations for conversations, messages, and metadata. ABOUTME: Repository for command history with FTS5 full-text search ABOUTME: Manages storage and retrieval of user messages and assistant responses
Package storage provides database operations for conversations, messages, and metadata. ABOUTME: Message CRUD operations for SQLite storage ABOUTME: Create, read, and list messages within conversations
Package storage provides database operations for conversations, messages, and metadata. ABOUTME: SQLite schema initialization and migration management ABOUTME: Handles database setup, table creation, and version tracking
Package storage provides database operations for conversations, messages, and metadata. ABOUTME: Todo repository for CRUD operations on todo items ABOUTME: Handles saving, loading, and clearing todo lists with optional conversation scoping
Index ¶
- func AddHistoryEntry(db *sql.DB, entry *HistoryEntry) error
- func ClearCompleted(db *sql.DB, conversationID *string) error
- func CreateConversation(db *sql.DB, conv *Conversation) error
- func CreateMessage(db *sql.DB, msg *Message) error
- func DeleteConversation(db *sql.DB, id string) error
- func OpenDatabase(path string) (*sql.DB, error)
- func RunMigrations(db *sql.DB) error
- func SaveTodos(db *sql.DB, todos []Todo, conversationID *string) error
- func SetFavorite(db *sql.DB, id string, isFavorite bool) error
- func UpdateConversationTimestamp(db *sql.DB, id string) error
- func UpdateConversationTitle(db *sql.DB, id, title string) error
- type Conversation
- type HistoryEntry
- type Message
- type Todo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHistoryEntry ¶
func AddHistoryEntry(db *sql.DB, entry *HistoryEntry) error
AddHistoryEntry saves a history entry to the database
func ClearCompleted ¶
ClearCompleted removes all completed todos for the given conversation (or global if nil)
func CreateConversation ¶
func CreateConversation(db *sql.DB, conv *Conversation) error
CreateConversation inserts a new conversation
func CreateMessage ¶
CreateMessage inserts a new message and updates conversation timestamp atomically
func DeleteConversation ¶
DeleteConversation deletes a conversation and its messages (via CASCADE)
func OpenDatabase ¶
OpenDatabase opens SQLite database at given path
func RunMigrations ¶ added in v1.4.0
RunMigrations executes database migrations using golang-migrate
func SaveTodos ¶
SaveTodos replaces all todos for the given conversation (or global if nil) with the provided list
func SetFavorite ¶
SetFavorite sets or unsets a conversation as favorite
func UpdateConversationTimestamp ¶
UpdateConversationTimestamp updates the updated_at field
Types ¶
type Conversation ¶
type Conversation struct {
ID string
Title string
Provider string
Model string
SystemPrompt string
CreatedAt time.Time
UpdatedAt time.Time
IsFavorite bool
}
Conversation represents a chat conversation
func GetConversation ¶
func GetConversation(db *sql.DB, id string) (*Conversation, error)
GetConversation retrieves a conversation by ID
func GetLatestConversation ¶
func GetLatestConversation(db *sql.DB) (*Conversation, error)
GetLatestConversation retrieves the most recently updated conversation
func ListConversations ¶
func ListConversations(db *sql.DB, limit, offset int) ([]*Conversation, error)
ListConversations returns conversations ordered by updated_at DESC
func ListFavorites ¶
func ListFavorites(db *sql.DB) ([]*Conversation, error)
ListFavorites returns all favorite conversations ordered by updated_at DESC
type HistoryEntry ¶
type HistoryEntry struct {
ID string
ConversationID string
UserMessage string
AssistantResponse string
CreatedAt time.Time
}
HistoryEntry represents a single command history entry
func GetRecentHistory ¶
func GetRecentHistory(db *sql.DB, limit int) ([]*HistoryEntry, error)
GetRecentHistory retrieves the most recent history entries
func SearchHistory ¶
SearchHistory performs FTS5 search on history
type Message ¶
type Message struct {
ID string
ConversationID string
Role string
Content string
ToolCalls string // JSON string
Metadata string // JSON string
CreatedAt time.Time
}
Message represents a chat message
func GetMessage ¶
GetMessage retrieves a message by ID