Synchronous N-API interface to SQLite.
The version of SQLite that is currently bundled with this extension is 3.31.1.
To use @decafcode/sqlite from your project simply install it using your preferred package manager:
$ npm install --save @decafcode/sqliteor
$ yarn add @decafcode/sqliteTypeScript definitions with TSDoc comments are included in the package. You may also consult the online copy of the project's Typedoc documentation output.
See INTERNALS.md for details about the internals of this project.
import Database from "@decafcode/sqlite";
function loadEmployees(path: string, departmentId: bigint): Employee[] {
const db = new Database(path);
const stmt = db.prepare(
"select id, name from employee where department_id = ?"
);
const rows = stmt.all([departmentId]);
const objects = new Array();
stmt.close();
for (const row of rows) {
objects.push(new Employee(row.id, row.name));
}
db.close();
return objects;
}
MIT
Generated using TypeDoc