Skip to main content

Module sqlite

Module sqlite 

Source
Expand description

SQLite primitives (sqlite.mjs): readers open read-only — the contract every supercode reader keeps over a live store — and writers create fresh files. Rows are read as JSON objects so the codecs see the same shapes the Node package saw.

Enums§

Param
A parameter value for write_table.

Functions§

read_rows
Every row of sql as a JSON object keyed by column name; None when the file does not exist.
replace_rows
Replace one table’s rows in place, inside a store other writers share (a Hermes home’s state.db): create the table when absent (ddl), add any column columns names that it lacks (Hermes’s own schema reconcile only ever adds columns), delete the rows delete selects and insert rows, in one transaction. Every other table in the file is left as it is.
table_exists
Whether table exists in the store at path (false when the file does not exist).
write_table
Create (ddl) and fill (insert, one parameter list per row) a store in one transaction.