feat(store): Store interface + SQLite reference impl + migration framework#2
Merged
Conversation
…n framework Introduces pkg/lore/store/store.go with the Store interface (Inscribe, Update, Get, DeleteBySource, ListByTag, ListByKind, SearchText, AddEdge, ListEdges, Close) plus pkg/lore/store/sqlite with a modernc.org/sqlite pure-Go backend. Key points: - Caller-owned *sql.DB; New() runs pending migrations and returns a Store. - OTel spans on every I/O method (lore.store.<op>); slog for migration progress and error logging. - BM25 FTS5 search via entries_fts virtual table with sync triggers. - JSON-encoded tags and metadata columns. - Options: WithLogger, WithTracer, WithDefaultLimit. - 16 tests covering all interface methods; all pass under -race. - Adds modernc.org/sqlite, go.opentelemetry.io/otel deps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg/lore/store/store.go: theStoreinterface with 10 methods (Inscribe, Update, Get, DeleteBySource, ListByTag, ListByKind, SearchText, AddEdge, ListEdges, Close), full per-method and interface-level godoc including error sentinel contracts.pkg/lore/store/sqlite/: SQLite-backed implementation usingmodernc.org/sqlite(pure Go, no CGO). Constructor accepts caller-owned*sql.DB, runs migrations on startup.pkg/lore/store/sqlite/migrations/001_initial.up.sql: entries table, edges table, FTS5 virtual table with sync triggers, schema_migrations table.lore.store.<op>) with lore.id, lore.kind, lore.source, lore.tag, lore.query.length, lore.limit attributes.slogused throughout; migration progress at Info, errors at Error level.WithLogger,WithTracer,WithDefaultLimit.-race.modernc.org/sqliteandgo.opentelemetry.io/oteldeps.Test plan
go test -race -count=1 ./...passes (verified locally)go vet ./...clean (verified locally)gofmt -l .reports no diffs (verified locally)