Skip to content

feat(store): Store interface + SQLite reference impl + migration framework#2

Merged
kunallanjewar merged 2 commits into
mainfrom
quest-2-store-sqlite
Apr 28, 2026
Merged

feat(store): Store interface + SQLite reference impl + migration framework#2
kunallanjewar merged 2 commits into
mainfrom
quest-2-store-sqlite

Conversation

@kunallanjewar
Copy link
Copy Markdown
Contributor

Summary

  • Adds pkg/lore/store/store.go: the Store interface with 10 methods (Inscribe, Update, Get, DeleteBySource, ListByTag, ListByKind, SearchText, AddEdge, ListEdges, Close), full per-method and interface-level godoc including error sentinel contracts.
  • Adds pkg/lore/store/sqlite/: SQLite-backed implementation using modernc.org/sqlite (pure Go, no CGO). Constructor accepts caller-owned *sql.DB, runs migrations on startup.
  • Adds pkg/lore/store/sqlite/migrations/001_initial.up.sql: entries table, edges table, FTS5 virtual table with sync triggers, schema_migrations table.
  • OTel spans on every I/O method (lore.store.<op>) with lore.id, lore.kind, lore.source, lore.tag, lore.query.length, lore.limit attributes.
  • slog used throughout; migration progress at Info, errors at Error level.
  • Options: WithLogger, WithTracer, WithDefaultLimit.
  • 16 tests covering all interface methods including error paths; pass under -race.
  • Updates README with Store usage example.
  • Adds modernc.org/sqlite and go.opentelemetry.io/otel deps.

Test plan

  • go test -race -count=1 ./... passes (verified locally)
  • go vet ./... clean (verified locally)
  • gofmt -l . reports no diffs (verified locally)
  • CI green on this PR

…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.
@kunallanjewar kunallanjewar marked this pull request as ready for review April 28, 2026 15:24
@kunallanjewar kunallanjewar merged commit 4284911 into main Apr 28, 2026
4 checks passed
@kunallanjewar kunallanjewar deleted the quest-2-store-sqlite branch April 28, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant