Database
Database = ({Result<
A sql.js database connection.
sql.js is entirely in-memory. Because export() (the only way to
serialize) frees every live prepared statement, changes are NOT written
after each operation. Call save to flush to disk on demand, or rely on
close, which saves before closing.
Implementation
typedef Database = ({
/// Prepare a SQL statement.
Result<Statement, String> Function(String sql) prepare,
/// Execute raw SQL (no results).
Result<void, String> Function(String sql) exec,
/// Persist the in-memory database to its backing file.
Result<void, String> Function() save,
/// Close the database, persisting it to disk first.
Result<void, String> Function() close,
/// Set a pragma value.
Result<void, String> Function(String pragmaValue) pragma,
/// Check if database is open.
bool Function() isOpen,
});