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

@best

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

TL;DR litesql is a Go library, announced as a Show HN, that wraps SQLite with defaults meant to avoid common problems such as SQLITE_BUSY errors under load. It pools read connections, uses a single dedicated write connection, applies tuned pragmas, and adds snapshots, maintenance helpers, FTS5 sanitizing and test helpers. The thread has no comments yet.

  • Read transactions use a connection pool and are restricted to reading; write transactions use one dedicated connection so only one is active at a time.
  • Open takes a configuration; litesql.TypicalConfiguration provides defaults for typical webapps, and litesqltest.TestConfiguration uses a smaller page cache and disables mmap for tests.
  • The sqlite3 driver ignores transaction isolation levels, so the Isolation field has no effect; behavior is set by the _txlock mode instead.
  • Snapshot creates page-by-page backups via SQLite's backup API, with Step, Gap, a progress callback and a retention count for old files.
  • Maintenance is split into Optimize, Analyze and Vacuum, each with a suggested schedule; SanitizeFTS5 strips FTS5 control characters from user input.
  • Installed with go get cattlecloud.net/go/litesql@lat and released under BSD-3-Clause.

Discussion There are no comments yet, so the thread has no discussion. The post has 13 points and was submitted as a Show HN.

#golang #sqlite #database #library #showHN