persistence

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sql.DB
}

DB wraps *sql.DB with SQLite-specific setup and schema migration.

func Open

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

Open creates a SQLite connection at dbPath. Use ":memory:" for an in-memory database.

func (*DB) Migrate

func (db *DB) Migrate() error

Migrate creates all tables and indexes if they do not exist.

func (*DB) MigrateTenantColumn

func (db *DB) MigrateTenantColumn() error

MigrateTenantColumn adds tenant_id to session_entries if it does not already exist. This handles upgrades from schemas that predate multi-tenancy.

func (*DB) SeedDefaults

func (db *DB) SeedDefaults() (string, error)

SeedDefaults creates a default tenant, admin user, and API key if no tenants exist. Returns the plaintext API key for one-time display, or empty string if already seeded.

Jump to

Keyboard shortcuts

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