storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 7 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

Overview

Package storage wraps the local SQLite database (WAL mode).

A pure-Go driver (modernc.org/sqlite) is used so the binary cross-compiles to linux/arm64 without a C toolchain, which the design doc requires for deploying to Orange Pi / Raspberry Pi nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *sql.DB) error

Migrate applies pending schema migrations and advances PRAGMA user_version. It is safe to call repeatedly: already-applied versions are skipped.

Migrations are defined in migrations.go. Each migration runs in its own transaction and updates user_version on success so a partially failed run can be retried without double-applying earlier steps.

func Now

func Now() int64

Now returns Unix seconds; SQLite timestamps are stored as epoch seconds.

func Open

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

Open opens (or creates) the SQLite database at path in WAL mode.

Types

type Migration

type Migration struct {
	Version int
	Name    string
	Apply   func(*sql.Tx) error
}

Migration is a single schema change identified by a monotonic version. Each migration runs inside its own transaction and, on success, advances PRAGMA user_version to its Version.

Jump to

Keyboard shortcuts

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