Warden

SQLite Store

Embedded SQLite store for single-instance deployments.

The SQLite store uses grove ORM with the sqlitedriver backend for an embedded database.

Usage

import (
    "github.com/xraph/grove"
    "github.com/xraph/grove/drivers/sqlitedriver"
    "github.com/xraph/warden/store/sqlite"
)

db, err := grove.Open(sqlitedriver.Open("warden.db"))
if err != nil {
    log.Fatal(err)
}

sqliteStore := sqlite.New(db)
defer sqliteStore.Close()

if err := sqliteStore.Migrate(ctx); err != nil {
    log.Fatal(err)
}

Characteristics

  • Embedded — No external database server needed
  • Pure Go — No CGO dependency
  • File-based — Data persists in a single file
  • Single-writer — SQLite uses file-level locking

Schema Differences from PostgreSQL

PostgreSQLSQLite
TIMESTAMPTZTEXT (RFC3339 format)
JSONBTEXT (JSON string)
UUIDTEXT
SERIALINTEGER PRIMARY KEY

When to Use

  • Single-instance CLI tools and desktop apps
  • Edge deployments without database infrastructure
  • Development when you want persistent data without PostgreSQL
  • Embedded authorization in standalone binaries

On this page