Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountRows ¶
CountRows runs a scalar count query (e.g. SELECT COUNT(*) FROM ...) and returns the integer result. Unlike QuerySQLite (which swallows per-row scan errors), CountRows uses QueryRow for fail-fast behavior on scan failures.
func QueryRows ¶
func QueryRows[T any](dbPath string, journalOff bool, query string, scanRow func(*sql.Rows) (T, error)) ([]T, error)
QueryRows is a generic helper (Go 1.18+) that wraps QuerySQLite and collects results into a typed slice. Each extract method only needs to provide the scan function that converts one database row into a typed value.
Rows that fail to scan are skipped (logged at debug level by QuerySQLite).
func QuerySQLite ¶
QuerySQLite opens a SQLite database, optionally disables journal mode (required for Firefox databases), runs the query, and calls scanFn for each row.
It validates the database file exists before opening to prevent sql.Open from silently creating an empty database.
scanFn should return nil to continue iteration, or an error to skip the current row (the error is logged at debug level and iteration continues).
Types ¶
This section is empty.