db

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package db opens Peen's SQLite database, applies its embedded migrations, and wires the generated gorm/gen repositories. Business code uses the typed repository layer rather than a raw database handle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Directory   string
	InMemory    bool
	BusyTimeout time.Duration
	Metrics     *metrics.Metrics
}

Config identifies the private directory and SQLite connection behavior.

type Handle

type Handle struct {
	GormDB *gorm.DB
	// contains filtered or unexported fields
}

Handle owns an open SQLite connection and its generated GORM query surface.

func Open

func Open(ctx context.Context, cfg Config) (*Handle, error)

Open opens Peen's SQLite store, migrates it, and verifies its integrity.

func (*Handle) Close

func (h *Handle) Close() error

Close releases the database resources held by the handle.

func (*Handle) SQLDB

func (h *Handle) SQLDB() *sql.DB

SQLDB exposes the infrastructure connection for migration and integrity verification. Request-path code must use generated repositories instead.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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