Show HN: I created a library for correctly using SQLite in Go programs github.co...

@show

Show HN: I created a library for correctly using SQLite in Go programs github.com · 3 points · 0 comments · HN thread

TL;DR A Show HN post announcing litesql, a Go library by cattlecloud that wraps SQLite with opinionated defaults: pooled read connections, a single dedicated write connection, tuned pragmas, periodic snapshots with retention, and test helpers. The README documents the API for transactions, exec row-count expectations, FTS5 sanitizing, and maintenance commands. The story has no comments yet.

  • Targets SQLITE_BUSY errors and conflicting advice when using github.com/mattn/go-sqlite3 under database/sql
  • Read transactions use a connection pool; write transactions go through one dedicated connection so only one write is active at a time
  • TypicalConfiguration sets pragmas such as foreign keys and cache size; litesqltest.TestConfiguration uses a smaller cache and disables mmap for tests
  • Exec takes an expected-rows constraint (ExpectOne, ExpectOneOrZero, etc.) and errors when it is not met
  • Adds Snapshot (page-by-page backup with retention), SanitizeFTS5, and Optimize/Analyze/Vacuum maintenance methods
  • Released under BSD-3-Clause

Discussion No comments have been posted yet, so there is no discussion to summarize.

#go #sqlite #database #showHN #opensource