sqlitex

package
v0.0.0-...-f07582e Latest Latest
Warning

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

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

Documentation

Overview

Package sqlitex holds the conventions shared by the SQLite databases this repository publishes: the schema era recorded in the file header, the TEXT encoding of time columns, and the gzip copy that moves a built database between local disk and a billy filesystem.

Index

Constants

View Source
const TimeFormat = "2006-01-02T15:04:05.000Z07:00"

TimeFormat is the TEXT encoding for time columns: UTC with fixed-width millisecond precision, so lexicographic comparison (what SQLite's ORDER BY and range operators do on TEXT) equals chronological order. It matches strftime('%Y-%m-%dT%H:%M:%fZ', ...), which extraction expressions use to normalize Go's variable-precision encoding. NULL means the timestamp was not recorded or did not parse.

Variables

This section is empty.

Functions

func CheckVersion

func CheckVersion(db *sqlite3.Conn, want int) error

CheckVersion errors unless db's header era is exactly want. A new era is published under a new object name, never in place under an old one, so a mismatch means a mislabeled publish rather than version skew for a reader to tolerate.

func Fetch

func Fetch(fs billy.Basic, name, dest string) error

Fetch gunzips the published database fs holds under name into a local file at dest.

func Publish

func Publish(fs billy.Basic, name, path string) (err error)

Publish gzips the database file at path into fs under name. Databases are stored gzipped on every filesystem (they compress about 8x), local directories included, so the .gz name is accurate wherever the copy lives.

func SetVersion

func SetVersion(db *sqlite3.Conn, v int) error

SetVersion records the schema era in the database header.

func TimeColumn

func TimeColumn(t time.Time) string

TimeColumn returns t in the TEXT encoding time columns use, for binding comparisons against them.

func Version

func Version(db *sqlite3.Conn) (int, error)

Version reads the schema era recorded in the database header (PRAGMA user_version). A database that never had one set reads zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

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