Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package db opens the SQLite database and applies embedded migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup added in v0.2.0

func Backup(ctx context.Context, d *sql.DB, source, destination string) error

Backup creates a SQLite snapshot or a PostgreSQL custom-format dump. PostgreSQL credentials are supplied as environment variables, never process arguments.

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir returns the directory holding the database and logs. SWITCHBOARD_DATA_DIR overrides it.

func DefaultPath

func DefaultPath() string

DefaultPath returns the default database file path.

func Describe added in v0.2.0

func Describe(s string) string

func IsPostgres added in v0.2.0

func IsPostgres(d *sql.DB) bool

func IsPostgresURL added in v0.2.0

func IsPostgresURL(s string) bool

func Migrate

func Migrate(ctx context.Context, d *sql.DB) error

Migrate applies any migration files not yet recorded in schema_migrations.

func Open

func Open(path string) (*sql.DB, error)

Open opens (creating if needed) the SQLite database at path, configures it for concurrent local use (WAL, busy timeout, immediate transactions) and applies pending migrations.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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