db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(sqlDB *sql.DB) error

Migrate runs all pending database migrations.

func NormalizeTorrentTimes

func NormalizeTorrentTimes(sqlDB *sql.DB) (int, error)

NormalizeTorrentTimes rewrites every torrents timestamp that isn't in dbtime's format. It runs on every startup and only touches rows that need it, so after the first run it's a cheap scan. Values it can't parse are left as they are.

Done in Go rather than as a SQL migration because the old values carry a zone and offset that SQLite's date functions can't parse.

Types

type DB

type DB struct {
	SQL *sql.DB
}

DB wraps the underlying sql.DB.

func Open

func Open(cfg config.DatabaseConfig) (*DB, error)

Open opens the SQLite database at the configured path.

func (*DB) Close

func (d *DB) Close() error

Close closes the underlying database connection.

Directories

Path Synopsis
Package admin owns the diagnostic registry and the soft-delete shim (cleanup_history) used by the Settings → System → Diagnostics tab.
Package admin owns the diagnostic registry and the soft-delete shim (cleanup_history) used by the Settings → System → Diagnostics tab.

Jump to

Keyboard shortcuts

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