Documentation
¶
Index ¶
- func RecordCleanupDeleted(table string, count int64)
- func RecordCleanupDuration(table string, seconds float64)
- func SetStorageSize(bytes int64)
- func SetTableSize(table string, bytes int64)
- type CheckpointResult
- type ContaminatedTopic
- type DashboardStats
- type Fact
- type FactHistory
- type FactHistoryFilter
- type FactHistoryRepository
- type FactHistoryResult
- type FactRepository
- type FactStats
- type LogRepository
- type MaintenanceRepository
- type MemoryBankRepository
- type MergeCandidate
- type Message
- type MessageRepository
- type OverlappingPair
- type RAGLog
- type RerankerCandidate
- type RerankerLog
- type RerankerLogRepository
- type RerankerToolCall
- type RerankerToolCallTopic
- type SQLiteStore
- func (s *SQLiteStore) AddFact(fact Fact) (int64, error)
- func (s *SQLiteStore) AddFactHistory(h FactHistory) error
- func (s *SQLiteStore) AddMessageToHistory(userID int64, message Message) error
- func (s *SQLiteStore) AddRAGLog(log RAGLog) error
- func (s *SQLiteStore) AddRerankerLog(log RerankerLog) error
- func (s *SQLiteStore) AddStat(stat Stat) error
- func (s *SQLiteStore) AddTopic(topic Topic) (int64, error)
- func (s *SQLiteStore) AddTopicWithoutMessageUpdate(topic Topic) (int64, error)
- func (s *SQLiteStore) Checkpoint() error
- func (s *SQLiteStore) CleanupFactHistory(keepPerUser int) (int64, error)
- func (s *SQLiteStore) CleanupRagLogs(keepPerUser int) (int64, error)
- func (s *SQLiteStore) CleanupRerankerLogs(keepPerUser int) (int64, error)
- func (s *SQLiteStore) ClearHistory(userID int64) error
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) CountContaminatedTopics(userID int64) (int, error)
- func (s *SQLiteStore) CountFactsOnOrphanedTopics(userID int64) (int, error)
- func (s *SQLiteStore) CountOrphanedTopics(userID int64) (int, error)
- func (s *SQLiteStore) CountOverlappingTopics(userID int64) (int, error)
- func (s *SQLiteStore) CreateTopic(topic Topic) (int64, error)
- func (s *SQLiteStore) DeleteFact(userID, id int64) error
- func (s *SQLiteStore) DeleteTopic(id int64) error
- func (s *SQLiteStore) DeleteTopicCascade(id int64) error
- func (s *SQLiteStore) FixContaminatedTopics(userID int64) (int64, error)
- func (s *SQLiteStore) GetAllFacts() ([]Fact, error)
- func (s *SQLiteStore) GetAllTopics() ([]Topic, error)
- func (s *SQLiteStore) GetAllUsers() ([]User, error)
- func (s *SQLiteStore) GetContaminatedTopics(userID int64) ([]ContaminatedTopic, error)
- func (s *SQLiteStore) GetDBSize() (int64, error)
- func (s *SQLiteStore) GetDashboardStats(userID int64) (*DashboardStats, error)
- func (s *SQLiteStore) GetFactHistory(userID int64, limit int) ([]FactHistory, error)
- func (s *SQLiteStore) GetFactHistoryExtended(filter FactHistoryFilter, limit, offset int, sortBy, sortDir string) (FactHistoryResult, error)
- func (s *SQLiteStore) GetFactStats() (FactStats, error)
- func (s *SQLiteStore) GetFactStatsByUser(userID int64) (FactStats, error)
- func (s *SQLiteStore) GetFacts(userID int64) ([]Fact, error)
- func (s *SQLiteStore) GetFactsAfterID(minID int64) ([]Fact, error)
- func (s *SQLiteStore) GetFactsByIDs(ids []int64) ([]Fact, error)
- func (s *SQLiteStore) GetFactsByTopicID(topicID int64) ([]Fact, error)
- func (s *SQLiteStore) GetLastTopicEndMessageID(userID int64) (int64, error)
- func (s *SQLiteStore) GetMemoryBank(userID int64) (string, error)
- func (s *SQLiteStore) GetMergeCandidates(userID int64) ([]MergeCandidate, error)
- func (s *SQLiteStore) GetMessagesByIDs(ids []int64) ([]Message, error)
- func (s *SQLiteStore) GetMessagesByTopicID(ctx context.Context, topicID int64) ([]Message, error)
- func (s *SQLiteStore) GetMessagesInRange(ctx context.Context, userID int64, startID, endID int64) ([]Message, error)
- func (s *SQLiteStore) GetOrphanedTopicIDs(userID int64) ([]int64, error)
- func (s *SQLiteStore) GetOverlappingTopics(userID int64) ([]OverlappingPair, error)
- func (s *SQLiteStore) GetRAGLogs(userID int64, limit int) ([]RAGLog, error)
- func (s *SQLiteStore) GetRecentHistory(userID int64, limit int) ([]Message, error)
- func (s *SQLiteStore) GetRerankerLogs(userID int64, limit int) ([]RerankerLog, error)
- func (s *SQLiteStore) GetStats() (map[int64]Stat, error)
- func (s *SQLiteStore) GetTableSizes() ([]TableSize, error)
- func (s *SQLiteStore) GetTopicExtractionLogs(limit, offset int) ([]RAGLog, int, error)
- func (s *SQLiteStore) GetTopics(userID int64) ([]Topic, error)
- func (s *SQLiteStore) GetTopicsAfterID(minID int64) ([]Topic, error)
- func (s *SQLiteStore) GetTopicsByIDs(ids []int64) ([]Topic, error)
- func (s *SQLiteStore) GetTopicsExtended(filter TopicFilter, limit, offset int, sortBy, sortDir string) (TopicResult, error)
- func (s *SQLiteStore) GetTopicsPendingFacts(userID int64) ([]Topic, error)
- func (s *SQLiteStore) GetUnprocessedMessages(userID int64) ([]Message, error)
- func (s *SQLiteStore) ImportMessage(userID int64, message Message) error
- func (s *SQLiteStore) Init() error
- func (s *SQLiteStore) RecalculateTopicRanges(userID int64) (int, error)
- func (s *SQLiteStore) RecalculateTopicSizes(userID int64) (int, error)
- func (s *SQLiteStore) ResetUserData(userID int64) error
- func (s *SQLiteStore) SetTopicConsolidationChecked(topicID int64, checked bool) error
- func (s *SQLiteStore) SetTopicFactsExtracted(topicID int64, extracted bool) error
- func (s *SQLiteStore) UpdateFact(fact Fact) error
- func (s *SQLiteStore) UpdateFactHistoryTopic(oldTopicID, newTopicID int64) error
- func (s *SQLiteStore) UpdateFactTopic(oldTopicID, newTopicID int64) error
- func (s *SQLiteStore) UpdateMemoryBank(userID int64, content string) error
- func (s *SQLiteStore) UpdateMessageTopic(messageID, topicID int64) error
- func (s *SQLiteStore) UpdateMessagesTopicInRange(ctx context.Context, userID, startMsgID, endMsgID, topicID int64) error
- func (s *SQLiteStore) UpsertUser(user User) error
- type Stat
- type StatsRepository
- type Storage
- type TableSize
- type Topic
- type TopicExtended
- type TopicFilter
- type TopicRepository
- type TopicResult
- type User
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecordCleanupDeleted ¶ added in v0.3.5
RecordCleanupDeleted records the number of deleted rows during cleanup.
func RecordCleanupDuration ¶ added in v0.3.5
RecordCleanupDuration records the duration of a cleanup operation.
func SetStorageSize ¶ added in v0.3.5
func SetStorageSize(bytes int64)
SetStorageSize updates the storage size metric.
func SetTableSize ¶ added in v0.3.5
SetTableSize updates the table size metric.
Types ¶
type CheckpointResult ¶ added in v0.4.6
type CheckpointResult struct {
Busy int // 0 = success, 1 = blocked by reader
Log int // Total frames in WAL file
Checkpointed int // Frames actually checkpointed
}
CheckpointResult contains the result of a WAL checkpoint operation.
type ContaminatedTopic ¶ added in v0.4.6
type ContaminatedTopic struct {
TopicID int64 `json:"topic_id"`
TopicOwner int64 `json:"topic_owner"`
TopicSummary string `json:"topic_summary"`
ForeignUsers []int64 `json:"foreign_users"`
ForeignMsgCnt int `json:"foreign_msg_count"`
TotalMsgCnt int `json:"total_msg_count"`
}
ContaminatedTopic represents a topic containing messages from other users.
type DashboardStats ¶
type DashboardStats struct {
TotalTopics int
AvgTopicSize float64
ProcessedTopicsPct float64
ConsolidatedTopics int
TotalFacts int
FactsByCategory map[string]int
FactsByType map[string]int
TotalMessages int
UnprocessedMessages int
TotalRAGQueries int
AvgRAGCost float64
MessagesPerDay map[string]int
FactsGrowth map[string]int
}
type FactHistory ¶
type FactHistoryFilter ¶
type FactHistoryRepository ¶
type FactHistoryRepository interface {
AddFactHistory(history FactHistory) error
UpdateFactHistoryTopic(oldTopicID, newTopicID int64) error
GetFactHistory(userID int64, limit int) ([]FactHistory, error)
GetFactHistoryExtended(filter FactHistoryFilter, limit, offset int, sortBy, sortDir string) (FactHistoryResult, error)
}
FactHistoryRepository handles fact history operations.
type FactHistoryResult ¶
type FactHistoryResult struct {
Data []FactHistory
TotalCount int
}
type FactRepository ¶
type FactRepository interface {
AddFact(fact Fact) (int64, error)
GetFacts(userID int64) ([]Fact, error)
GetFactsByIDs(ids []int64) ([]Fact, error)
GetFactsByTopicID(topicID int64) ([]Fact, error)
GetAllFacts() ([]Fact, error)
GetFactsAfterID(minID int64) ([]Fact, error)
GetFactStats() (FactStats, error)
GetFactStatsByUser(userID int64) (FactStats, error)
UpdateFact(fact Fact) error
UpdateFactTopic(oldTopicID, newTopicID int64) error
DeleteFact(userID, id int64) error
}
FactRepository handles fact operations.
type LogRepository ¶
type LogRepository interface {
AddRAGLog(log RAGLog) error
GetRAGLogs(userID int64, limit int) ([]RAGLog, error)
GetTopicExtractionLogs(limit, offset int) ([]RAGLog, int, error)
}
LogRepository handles RAG log operations.
type MaintenanceRepository ¶ added in v0.3.5
type MaintenanceRepository interface {
GetDBSize() (int64, error)
GetTableSizes() ([]TableSize, error)
CleanupFactHistory(keepPerUser int) (int64, error)
CleanupRagLogs(keepPerUser int) (int64, error)
CleanupRerankerLogs(keepPerUser int) (int64, error)
// Database health diagnostics
CountOrphanedTopics(userID int64) (int, error)
GetOrphanedTopicIDs(userID int64) ([]int64, error)
CountOverlappingTopics(userID int64) (int, error)
GetOverlappingTopics(userID int64) ([]OverlappingPair, error)
CountFactsOnOrphanedTopics(userID int64) (int, error)
RecalculateTopicRanges(userID int64) (int, error)
RecalculateTopicSizes(userID int64) (int, error)
// Cross-user contamination detection and repair
GetContaminatedTopics(userID int64) ([]ContaminatedTopic, error)
CountContaminatedTopics(userID int64) (int, error)
FixContaminatedTopics(userID int64) (int64, error)
// WAL checkpoint for ensuring data persistence
Checkpoint() error
}
MaintenanceRepository handles database maintenance operations.
type MemoryBankRepository ¶
type MemoryBankRepository interface {
GetMemoryBank(userID int64) (string, error)
UpdateMemoryBank(userID int64, content string) error
}
MemoryBankRepository handles the legacy memory bank.
type MergeCandidate ¶
type MessageRepository ¶
type MessageRepository interface {
AddMessageToHistory(userID int64, message Message) error
ImportMessage(userID int64, message Message) error
GetRecentHistory(userID int64, limit int) ([]Message, error)
GetMessagesByIDs(ids []int64) ([]Message, error)
ClearHistory(userID int64) error
GetMessagesInRange(ctx context.Context, userID int64, startID, endID int64) ([]Message, error)
GetMessagesByTopicID(ctx context.Context, topicID int64) ([]Message, error)
UpdateMessageTopic(messageID, topicID int64) error
UpdateMessagesTopicInRange(ctx context.Context, userID, startMsgID, endMsgID, topicID int64) error
GetUnprocessedMessages(userID int64) ([]Message, error)
}
MessageRepository handles message history operations.
type OverlappingPair ¶ added in v0.4.6
type OverlappingPair struct {
Topic1ID int64
Topic1Summary string
Topic2ID int64
Topic2Summary string
}
OverlappingPair contains information about two overlapping topics.
type RAGLog ¶
type RAGLog struct {
ID int64
UserID int64
OriginalQuery string
EnrichedQuery string
EnrichmentPrompt string
ContextUsed string // The full context sent to the generation model
SystemPrompt string
RetrievalResults string // JSON array of retrieved messages
LLMResponse string
EnrichmentTokens int
GenerationTokens int
TotalCostUSD float64
CreatedAt time.Time
}
type RerankerCandidate ¶ added in v0.4.1
type RerankerCandidate struct {
TopicID int64 `json:"topic_id"`
Summary string `json:"summary"`
Score float32 `json:"score"`
Date string `json:"date"`
MessageCount int `json:"message_count"`
SizeChars int `json:"size_chars"`
}
RerankerCandidate is a single candidate for JSON serialization
type RerankerLog ¶ added in v0.4.1
type RerankerLog struct {
ID int64
UserID int64
OriginalQuery string
EnrichedQuery string
CandidatesJSON string // JSON array of candidates with scores
ToolCallsJSON string // JSON array of tool call iterations
SelectedIDsJSON string // JSON array of selected topic IDs
ReasoningJSON string // JSON array of reasoning entries per iteration
FallbackReason *string // nil if no fallback, otherwise reason
DurationEnrichmentMs int
DurationVectorMs int
DurationRerankerMs int
DurationTotalMs int
CreatedAt time.Time
}
RerankerLog stores debug traces from the reranker component
type RerankerLogRepository ¶ added in v0.4.1
type RerankerLogRepository interface {
AddRerankerLog(log RerankerLog) error
GetRerankerLogs(userID int64, limit int) ([]RerankerLog, error)
}
RerankerLogRepository handles reranker debug log operations.
type RerankerToolCall ¶ added in v0.4.1
type RerankerToolCall struct {
Iteration int `json:"iteration"`
TopicIDs []int64 `json:"topic_ids"`
Topics []RerankerToolCallTopic `json:"topics"`
}
RerankerToolCall represents one iteration of tool calls
type RerankerToolCallTopic ¶ added in v0.4.1
RerankerToolCallTopic contains topic info for tool call display
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func NewSQLiteStore ¶
func NewSQLiteStore(logger *slog.Logger, path string) (*SQLiteStore, error)
func (*SQLiteStore) AddFactHistory ¶
func (s *SQLiteStore) AddFactHistory(h FactHistory) error
func (*SQLiteStore) AddMessageToHistory ¶
func (s *SQLiteStore) AddMessageToHistory(userID int64, message Message) error
func (*SQLiteStore) AddRAGLog ¶
func (s *SQLiteStore) AddRAGLog(log RAGLog) error
func (*SQLiteStore) AddRerankerLog ¶ added in v0.4.1
func (s *SQLiteStore) AddRerankerLog(log RerankerLog) error
AddRerankerLog saves a reranker debug trace.
func (*SQLiteStore) AddStat ¶
func (s *SQLiteStore) AddStat(stat Stat) error
func (*SQLiteStore) AddTopicWithoutMessageUpdate ¶ added in v0.4.6
func (s *SQLiteStore) AddTopicWithoutMessageUpdate(topic Topic) (int64, error)
AddTopicWithoutMessageUpdate creates a topic without updating message references. Used when manually managing message-topic relationships (e.g., during topic splitting).
func (*SQLiteStore) Checkpoint ¶ added in v0.4.6
func (s *SQLiteStore) Checkpoint() error
Checkpoint forces a WAL checkpoint to flush all pending writes to the main database file. This is useful before shutdown or after critical writes to ensure data persistence. Returns CheckpointResult with details about what was checkpointed.
func (*SQLiteStore) CleanupFactHistory ¶ added in v0.3.5
func (s *SQLiteStore) CleanupFactHistory(keepPerUser int) (int64, error)
CleanupFactHistory removes old fact_history records, keeping only the N most recent per user. Returns the number of deleted rows.
func (*SQLiteStore) CleanupRagLogs ¶ added in v0.3.5
func (s *SQLiteStore) CleanupRagLogs(keepPerUser int) (int64, error)
CleanupRagLogs removes old rag_logs records, keeping only the N most recent per user. Returns the number of deleted rows.
func (*SQLiteStore) CleanupRerankerLogs ¶ added in v0.4.1
func (s *SQLiteStore) CleanupRerankerLogs(keepPerUser int) (int64, error)
CleanupRerankerLogs removes old reranker_logs records, keeping only the N most recent per user. Returns the number of deleted rows.
func (*SQLiteStore) ClearHistory ¶
func (s *SQLiteStore) ClearHistory(userID int64) error
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
func (*SQLiteStore) CountContaminatedTopics ¶ added in v0.4.6
func (s *SQLiteStore) CountContaminatedTopics(userID int64) (int, error)
CountContaminatedTopics counts topics with cross-user contamination. If userID is 0, counts all; otherwise only for specified user.
func (*SQLiteStore) CountFactsOnOrphanedTopics ¶ added in v0.4.6
func (s *SQLiteStore) CountFactsOnOrphanedTopics(userID int64) (int, error)
CountFactsOnOrphanedTopics counts facts linked to orphaned topics. If userID is 0, counts for all users.
func (*SQLiteStore) CountOrphanedTopics ¶ added in v0.4.6
func (s *SQLiteStore) CountOrphanedTopics(userID int64) (int, error)
CountOrphanedTopics counts topics with no messages linked to them. If userID is 0, counts for all users.
func (*SQLiteStore) CountOverlappingTopics ¶ added in v0.4.6
func (s *SQLiteStore) CountOverlappingTopics(userID int64) (int, error)
CountOverlappingTopics counts pairs of topics with overlapping message ranges. If userID is 0, counts for all users.
func (*SQLiteStore) CreateTopic ¶
func (s *SQLiteStore) CreateTopic(topic Topic) (int64, error)
func (*SQLiteStore) DeleteFact ¶
func (s *SQLiteStore) DeleteFact(userID, id int64) error
func (*SQLiteStore) DeleteTopic ¶
func (s *SQLiteStore) DeleteTopic(id int64) error
func (*SQLiteStore) DeleteTopicCascade ¶
func (s *SQLiteStore) DeleteTopicCascade(id int64) error
func (*SQLiteStore) FixContaminatedTopics ¶ added in v0.4.6
func (s *SQLiteStore) FixContaminatedTopics(userID int64) (int64, error)
FixContaminatedTopics removes foreign messages from contaminated topics by setting their topic_id to NULL. Returns the number of messages unlinked. If userID is 0, fixes all; otherwise only topics owned by specified user.
func (*SQLiteStore) GetAllFacts ¶
func (s *SQLiteStore) GetAllFacts() ([]Fact, error)
func (*SQLiteStore) GetAllTopics ¶
func (s *SQLiteStore) GetAllTopics() ([]Topic, error)
func (*SQLiteStore) GetAllUsers ¶
func (s *SQLiteStore) GetAllUsers() ([]User, error)
func (*SQLiteStore) GetContaminatedTopics ¶ added in v0.4.6
func (s *SQLiteStore) GetContaminatedTopics(userID int64) ([]ContaminatedTopic, error)
GetContaminatedTopics finds topics that contain messages from users other than the topic owner. If userID is 0, checks all topics; otherwise only topics owned by userID.
func (*SQLiteStore) GetDBSize ¶ added in v0.3.5
func (s *SQLiteStore) GetDBSize() (int64, error)
GetDBSize returns the size of the database file in bytes.
func (*SQLiteStore) GetDashboardStats ¶
func (s *SQLiteStore) GetDashboardStats(userID int64) (*DashboardStats, error)
func (*SQLiteStore) GetFactHistory ¶
func (s *SQLiteStore) GetFactHistory(userID int64, limit int) ([]FactHistory, error)
func (*SQLiteStore) GetFactHistoryExtended ¶
func (s *SQLiteStore) GetFactHistoryExtended(filter FactHistoryFilter, limit, offset int, sortBy, sortDir string) (FactHistoryResult, error)
func (*SQLiteStore) GetFactStats ¶
func (s *SQLiteStore) GetFactStats() (FactStats, error)
func (*SQLiteStore) GetFactStatsByUser ¶ added in v0.3.5
func (s *SQLiteStore) GetFactStatsByUser(userID int64) (FactStats, error)
func (*SQLiteStore) GetFactsAfterID ¶ added in v0.2.1
func (s *SQLiteStore) GetFactsAfterID(minID int64) ([]Fact, error)
func (*SQLiteStore) GetFactsByIDs ¶
func (s *SQLiteStore) GetFactsByIDs(ids []int64) ([]Fact, error)
func (*SQLiteStore) GetFactsByTopicID ¶ added in v0.4.6
func (s *SQLiteStore) GetFactsByTopicID(topicID int64) ([]Fact, error)
func (*SQLiteStore) GetLastTopicEndMessageID ¶
func (s *SQLiteStore) GetLastTopicEndMessageID(userID int64) (int64, error)
func (*SQLiteStore) GetMemoryBank ¶
func (s *SQLiteStore) GetMemoryBank(userID int64) (string, error)
func (*SQLiteStore) GetMergeCandidates ¶
func (s *SQLiteStore) GetMergeCandidates(userID int64) ([]MergeCandidate, error)
func (*SQLiteStore) GetMessagesByIDs ¶
func (s *SQLiteStore) GetMessagesByIDs(ids []int64) ([]Message, error)
func (*SQLiteStore) GetMessagesByTopicID ¶ added in v0.4.6
func (*SQLiteStore) GetMessagesInRange ¶
func (*SQLiteStore) GetOrphanedTopicIDs ¶ added in v0.4.6
func (s *SQLiteStore) GetOrphanedTopicIDs(userID int64) ([]int64, error)
GetOrphanedTopicIDs returns IDs of topics with no messages linked. If userID is 0, returns for all users.
func (*SQLiteStore) GetOverlappingTopics ¶ added in v0.4.6
func (s *SQLiteStore) GetOverlappingTopics(userID int64) ([]OverlappingPair, error)
GetOverlappingTopics returns pairs of topics with overlapping message ranges. If userID is 0, returns for all users.
func (*SQLiteStore) GetRAGLogs ¶
func (s *SQLiteStore) GetRAGLogs(userID int64, limit int) ([]RAGLog, error)
func (*SQLiteStore) GetRecentHistory ¶
func (s *SQLiteStore) GetRecentHistory(userID int64, limit int) ([]Message, error)
func (*SQLiteStore) GetRerankerLogs ¶ added in v0.4.1
func (s *SQLiteStore) GetRerankerLogs(userID int64, limit int) ([]RerankerLog, error)
GetRerankerLogs retrieves recent reranker traces for a user.
func (*SQLiteStore) GetTableSizes ¶ added in v0.3.5
func (s *SQLiteStore) GetTableSizes() ([]TableSize, error)
GetTableSizes returns the size of each table in bytes using SQLite's dbstat virtual table.
func (*SQLiteStore) GetTopicExtractionLogs ¶
func (s *SQLiteStore) GetTopicExtractionLogs(limit, offset int) ([]RAGLog, int, error)
func (*SQLiteStore) GetTopicsAfterID ¶ added in v0.2.1
func (s *SQLiteStore) GetTopicsAfterID(minID int64) ([]Topic, error)
func (*SQLiteStore) GetTopicsByIDs ¶ added in v0.2.1
func (s *SQLiteStore) GetTopicsByIDs(ids []int64) ([]Topic, error)
func (*SQLiteStore) GetTopicsExtended ¶
func (s *SQLiteStore) GetTopicsExtended(filter TopicFilter, limit, offset int, sortBy, sortDir string) (TopicResult, error)
func (*SQLiteStore) GetTopicsPendingFacts ¶
func (s *SQLiteStore) GetTopicsPendingFacts(userID int64) ([]Topic, error)
func (*SQLiteStore) GetUnprocessedMessages ¶
func (s *SQLiteStore) GetUnprocessedMessages(userID int64) ([]Message, error)
func (*SQLiteStore) ImportMessage ¶
func (s *SQLiteStore) ImportMessage(userID int64, message Message) error
func (*SQLiteStore) Init ¶
func (s *SQLiteStore) Init() error
func (*SQLiteStore) RecalculateTopicRanges ¶ added in v0.4.6
func (s *SQLiteStore) RecalculateTopicRanges(userID int64) (int, error)
RecalculateTopicRanges recalculates start_msg_id and end_msg_id for all topics based on actual message assignments. If userID is 0, recalculates for all users.
func (*SQLiteStore) RecalculateTopicSizes ¶ added in v0.4.6
func (s *SQLiteStore) RecalculateTopicSizes(userID int64) (int, error)
RecalculateTopicSizes recalculates size_chars for all topics based on actual message content. If userID is 0, recalculates for all users.
func (*SQLiteStore) ResetUserData ¶
func (s *SQLiteStore) ResetUserData(userID int64) error
func (*SQLiteStore) SetTopicConsolidationChecked ¶
func (s *SQLiteStore) SetTopicConsolidationChecked(topicID int64, checked bool) error
func (*SQLiteStore) SetTopicFactsExtracted ¶
func (s *SQLiteStore) SetTopicFactsExtracted(topicID int64, extracted bool) error
func (*SQLiteStore) UpdateFact ¶
func (s *SQLiteStore) UpdateFact(fact Fact) error
func (*SQLiteStore) UpdateFactHistoryTopic ¶
func (s *SQLiteStore) UpdateFactHistoryTopic(oldTopicID, newTopicID int64) error
func (*SQLiteStore) UpdateFactTopic ¶
func (s *SQLiteStore) UpdateFactTopic(oldTopicID, newTopicID int64) error
func (*SQLiteStore) UpdateMemoryBank ¶
func (s *SQLiteStore) UpdateMemoryBank(userID int64, content string) error
func (*SQLiteStore) UpdateMessageTopic ¶
func (s *SQLiteStore) UpdateMessageTopic(messageID, topicID int64) error
func (*SQLiteStore) UpdateMessagesTopicInRange ¶ added in v0.4.6
func (s *SQLiteStore) UpdateMessagesTopicInRange(ctx context.Context, userID, startMsgID, endMsgID, topicID int64) error
func (*SQLiteStore) UpsertUser ¶
func (s *SQLiteStore) UpsertUser(user User) error
type StatsRepository ¶
type StatsRepository interface {
AddStat(stat Stat) error
GetStats() (map[int64]Stat, error)
GetDashboardStats(userID int64) (*DashboardStats, error)
}
StatsRepository handles usage statistics.
type TopicExtended ¶
type TopicFilter ¶
type TopicRepository ¶
type TopicRepository interface {
AddTopic(topic Topic) (int64, error)
AddTopicWithoutMessageUpdate(topic Topic) (int64, error)
CreateTopic(topic Topic) (int64, error)
DeleteTopic(id int64) error
DeleteTopicCascade(id int64) error
GetLastTopicEndMessageID(userID int64) (int64, error)
GetAllTopics() ([]Topic, error)
GetTopicsAfterID(minID int64) ([]Topic, error)
GetTopicsByIDs(ids []int64) ([]Topic, error)
GetTopics(userID int64) ([]Topic, error)
SetTopicFactsExtracted(topicID int64, extracted bool) error
SetTopicConsolidationChecked(topicID int64, checked bool) error
GetTopicsPendingFacts(userID int64) ([]Topic, error)
GetTopicsExtended(filter TopicFilter, limit, offset int, sortBy, sortDir string) (TopicResult, error)
GetMergeCandidates(userID int64) ([]MergeCandidate, error)
}
TopicRepository handles topic operations.
type TopicResult ¶
type TopicResult struct {
Data []TopicExtended
TotalCount int
}