SQLite Store
Lightweight SQLite store for development, testing, and single-node deployments.
The store/sqlite package implements Nexus's store.Store interface using the grove ORM with the SQLite driver. It requires no external database process, making it ideal for development, integration tests, and single-node deployments.
Usage
import (
"github.com/xraph/grove"
"github.com/xraph/grove/drivers/sqlitedriver"
"github.com/xraph/nexus/store/sqlite"
)
db, err := grove.Open(sqlitedriver.Open("nexus.db"))
if err != nil {
log.Fatal(err)
}
s := sqlite.New(db)
if err := s.Migrate(); err != nil {
log.Fatal(err)
}
gw := nexus.New(
nexus.WithDatabase(s),
)Pass ":memory:" for a fully in-process, zero-persistence store useful in tests:
db, err := grove.Open(sqlitedriver.Open(":memory:"))Internals
| Aspect | Detail |
|---|---|
| Driver | grove ORM + sqlitedriver |
| Migrations | grove orchestrator with programmatic migrations |
| Transactions | SQLite-level transactions |
| Concurrency | Multiple readers, single writer (WAL mode) |
When to use
- Development and local testing without external dependencies.
- Single-process or embedded deployments.
- CI pipelines where spinning up PostgreSQL is impractical.