main 513e211

v0.3.0

tag
v0.3.0Latest
commit
513e211
published
2026-11-29

The sqlite package now exposes a broad safe Go API generated from sqlite3.h, including Go callbacks. The project layout is simpler, and the README is rewritten for library users.

Breaking changes

  • sqlite.Open returns *sqlite.Conn instead of the sqlite.DB interface. sqlite.DB is removed.
  • Conn.Prepare, Conn.Query and Conn.Exec return the concrete types *sqlite.Stmt, *sqlite.Rows and *sqlite.Result.
  • Mockable interfaces live in sqlite/sqliteiface. Use sqliteiface.Wrap(conn) to get a sqliteiface.DB. The mocks in sqlite/mocks use these interfaces.
  • Go 1.27 or later is required (was 1.26).

New

  • Generated safe API: Conn, Stmt, Blob, Backup, Context and Value methods with Go errors, strings, out-parameters and handle lifetimes.
  • Errors: sentinels for every primary and extended result code (ErrBusy, ErrConstraintPrimaryKey, …). They work with errors.Is and errors.As(*sqlite.Error). ErrNotAvailable is returned when the loaded SQLite lacks a function.
  • Blobs and backup: incremental blob I/O (BlobOpen, Read, Write, Reopen) and online backup (Conn.Backup, Step).
  • Operations: WALCheckpoint, WALAutoCheckpoint, LoadExtension, Limit, TxnState, status counters, and expanded and normalized SQL.
  • Go callbacks: CreateFunction, CreateAggregate, CreateCollation, ExecFunc, BusyHandler, BusyTimeout, CommitHook, RollbackHook, UpdateHook, ProgressHandler and SetAuthorizer. A panic in a callback is recovered and returned as a *sqlite.CallbackPanicError by the call that ran it.
  • OpenFlags: explicit SQLITE_OPEN_* flags and VFS selection. Open uses sqlite3_open_v2 and accepts file: URIs.

Not supported yet

  • Window functions written in Go
  • Virtual tables
  • trace_v2, wal_hook, preupdate_hook
  • Session and changeset
  • serialize / deserialize
  • UTF-16 APIs

cmd/sqlitegen/coverage_gen.tsv lists the status of every C function.

Install

go get bnema.dev/purego-sqlite@v0.3.0

Requires Linux, CGO_ENABLED=0, and libsqlite3.so or libsqlite3.so.0 at runtime.

Assets

no assets.

Source

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. On pages with a side panel: into the panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit; in a file, click a line number to select it, shift-click for a range
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 8

↑↓ moveenter openesc close