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
- func CheckVersion(db *sqlite3.Conn, want int) error
- func Fetch(fs billy.Basic, name, dest string) error
- func Publish(fs billy.Basic, name, path string) (err error)
- func SetVersion(db *sqlite3.Conn, v int) error
- func TimeColumn(t time.Time) string
- func Version(db *sqlite3.Conn) (int, error)
Constants ¶
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 ¶
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 Publish ¶
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 ¶
SetVersion records the schema era in the database header.
func TimeColumn ¶
TimeColumn returns t in the TEXT encoding time columns use, for binding comparisons against them.
Types ¶
This section is empty.