store

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLiteStore

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

SQLiteStore is the SQLite-backed implementation of domain.LoreStore.

func Open

func Open(dbPath string) (*SQLiteStore, error)

Open creates or opens a SQLite database at dbPath with WAL mode, foreign keys ON, and busy_timeout 5000ms. Applies schema migration if needed.

func (*SQLiteStore) AIStatsByDay

func (s *SQLiteStore) AIStatsByDay(days int) ([]domain.DailyAIStats, error)

func (*SQLiteStore) AIStatsSince

func (s *SQLiteStore) AIStatsSince(since time.Time) (*domain.AIStatsAggregate, error)

func (*SQLiteStore) AllDocSummaries

func (s *SQLiteStore) AllDocSummaries(limit int) ([]domain.DocIndexEntry, error)

AllDocSummaries returns up to limit documents ordered by date descending.

func (*SQLiteStore) AllPatterns

func (s *SQLiteStore) AllPatterns() ([]domain.CommitPattern, error)

func (*SQLiteStore) CacheReview

func (s *SQLiteStore) CacheReview(report domain.ReviewCacheEntry) error

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

Close closes the database connection.

func (*SQLiteStore) CommitCountByDecision

func (s *SQLiteStore) CommitCountByDecision() (map[string]int, error)

CommitCountByDecision returns a map of decision → count.

func (*SQLiteStore) CommitsByBranch

func (s *SQLiteStore) CommitsByBranch(branch string) ([]domain.CommitRecord, error)

CommitsByBranch returns commits on a given branch.

func (*SQLiteStore) CommitsByScope

func (s *SQLiteStore) CommitsByScope(scope string, days int) ([]domain.CommitRecord, error)

CommitsByScope returns commits matching scope within the last N days.

func (*SQLiteStore) CommitsSince

func (s *SQLiteStore) CommitsSince(since time.Time) ([]domain.CommitRecord, error)

CommitsSince returns commits after a given time.

func (*SQLiteStore) DocCount

func (s *SQLiteStore) DocCount() (int, error)

DocCount returns total number of indexed documents.

func (*SQLiteStore) DocsByBranch

func (s *SQLiteStore) DocsByBranch(branch string) ([]domain.DocIndexEntry, error)

DocsByBranch returns documents from a given branch.

func (*SQLiteStore) DocsByCommitHash

func (s *SQLiteStore) DocsByCommitHash(hash string) ([]domain.DocIndexEntry, error)

DocsByCommitHash returns documents linked to a commit.

func (*SQLiteStore) DocsByScope

func (s *SQLiteStore) DocsByScope(scope string) ([]domain.DocIndexEntry, error)

DocsByScope returns documents matching a scope.

func (*SQLiteStore) DocsByType

func (s *SQLiteStore) DocsByType(docType string) ([]domain.DocIndexEntry, error)

DocsByType returns documents of a given type.

func (*SQLiteStore) EntityHistory

func (s *SQLiteStore) EntityHistory(entityName, lang string) ([]domain.CodeSignature, error)

func (*SQLiteStore) FindBySignatureHash

func (s *SQLiteStore) FindBySignatureHash(sigHash string) ([]domain.CodeSignature, error)

func (*SQLiteStore) GetCachedReview

func (s *SQLiteStore) GetCachedReview(corpusHash string) (*domain.ReviewCacheEntry, error)

func (*SQLiteStore) GetCommit

func (s *SQLiteStore) GetCommit(hash string) (*domain.CommitRecord, error)

GetCommit returns a commit by hash, or nil if not found.

func (*SQLiteStore) GetDoc

func (s *SQLiteStore) GetDoc(filename string) (*domain.DocIndexEntry, error)

GetDoc returns a document by filename, or nil if not found.

func (*SQLiteStore) GetPattern

func (s *SQLiteStore) GetPattern(convType, scope string) (*domain.CommitPattern, error)

func (*SQLiteStore) IndexDoc

func (s *SQLiteStore) IndexDoc(entry domain.DocIndexEntry) error

IndexDoc inserts or replaces a document index entry.

func (*SQLiteStore) Migrate

func (s *SQLiteStore) Migrate() error

Migrate applies all pending schema migrations incrementally. Idempotent.

func (*SQLiteStore) Rebuild

func (s *SQLiteStore) Rebuild(ctx context.Context, docsDir string, git domain.GitAdapter) error

func (*SQLiteStore) RebuildFromSources

func (s *SQLiteStore) RebuildFromSources(ctx context.Context, docsDir string, git domain.GitAdapter) (int, int, int, error)

RebuildFromSources reconstructs doc_index from .md files and commits from git log. This is the real implementation replacing the stub in stubs.go.

func (*SQLiteStore) RecordAIUsage

func (s *SQLiteStore) RecordAIUsage(usage domain.AIUsageRecord) error

func (*SQLiteStore) RecordCommit

func (s *SQLiteStore) RecordCommit(rec domain.CommitRecord) error

RecordCommit inserts or replaces a commit record.

func (*SQLiteStore) RemoveDoc

func (s *SQLiteStore) RemoveDoc(filename string) error

RemoveDoc deletes a document from the index.

func (*SQLiteStore) ReviewHistory

func (s *SQLiteStore) ReviewHistory(limit int) ([]domain.ReviewCacheEntry, error)

func (*SQLiteStore) ScopeStats

func (s *SQLiteStore) ScopeStats(scope string, days int) (domain.ScopeStatsResult, error)

ScopeStats returns aggregated statistics for a scope, computing in SQL instead of loading all records into memory.

func (*SQLiteStore) SearchDocs

func (s *SQLiteStore) SearchDocs(ctx context.Context, query string) ([]domain.DocIndexEntry, error)

SearchDocs performs a simple LIKE search across key text fields.

func (*SQLiteStore) SignaturesForCommit

func (s *SQLiteStore) SignaturesForCommit(commitHash string) ([]domain.CodeSignature, error)

func (*SQLiteStore) StoreSignatures

func (s *SQLiteStore) StoreSignatures(commitHash string, sigs []domain.CodeSignature) error

func (*SQLiteStore) UnconsolidatedDocs

func (s *SQLiteStore) UnconsolidatedDocs(scope string) ([]domain.DocIndexEntry, error)

UnconsolidatedDocs returns docs not yet consolidated for a scope.

func (*SQLiteStore) UndocumentedCommits

func (s *SQLiteStore) UndocumentedCommits() ([]domain.CommitRecord, error)

UndocumentedCommits returns commits with decision pending or unknown.

func (*SQLiteStore) UpdatePattern

func (s *SQLiteStore) UpdatePattern(convType, scope string, decision string, diffLines, score int) error

func (*SQLiteStore) Vacuum

func (s *SQLiteStore) Vacuum() error

Jump to

Keyboard shortcuts

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