lines
Package lines exposes a text file as a SQLite virtual table — one row per line. Companion to ext/csv for unstructured logs and newline-delimited content where the data isn’t comma-separated.
CREATE VIRTUAL TABLE temp.log USING lines(filename='app.log');SELECT lineno, line FROM temp.log WHERE line LIKE 'ERROR%';For a typed Go handle that hides the USING lines(…) argument string and its quoting — Create / Open / Columns / Rows / Name / Drop — see Table.
Module parameters
Section titled “Module parameters”- filename=‘path’ — read from the configured filesystem (os.Open by default; fs.FS when RegisterFS is used).
- data=‘inline content’ — inline source. Mutually exclusive with filename.
- schema=‘CREATE TABLE x(lineno INTEGER, line TEXT)’ — override the declared schema. Default declares
lineno INTEGER, line TEXT.
import ( sqlite "gosqlite.org" "gosqlite.org/ext/lines")
if err := lines.Register(conn); err != nil { ... }For sandboxed file access (embed.FS, fstest.MapFS, os.DirFS):
lines.RegisterFS(conn, fsys)Blank-import auto-registration uses os-backed file access:
import _ "gosqlite.org/ext/lines/auto"Ported from ncruces/ext/lines.
Full API: pkg.go.dev/gosqlite.org/ext/lines