A Node.js adapter for PawSQLite
Go to file
2021-03-14 21:46:25 -07:00
cjs Corrected ES6 exports 2021-03-14 21:46:25 -07:00
src Corrected ES6 exports 2021-03-14 21:46:25 -07:00
.gitignore Initial commit 2021-03-02 23:16:52 -08:00
package-lock.json Added sqlite3 dependency 2021-03-02 23:20:03 -08:00
package.json Corrected ES6 exports 2021-03-14 21:46:25 -07:00
README.md Updated README 2021-03-04 22:14:08 -08:00
webpack.config.js Corrected ES6 exports 2021-03-14 21:46:25 -07:00

PawSQLite Node Adapter

A Node adapter for PawSQLite using the sqlite3 package.

Installation

You can install using npm:

npm install -s git+https://git.n0m.org/n0m/PawSQLite.git
npm install -s git+https://git.n0m.org/n0m/PawSQLite-Node-Adapter.git

Usage

For more detailed usage, please see: https://git.n0m.org/n0m/PawSQLite

const PawSQLite = require("pawsqlite");
const PawSQLiteNodeAdapter = require("pawsqlite-node-adapter");

PawSQLite.registerAdapter(PawSQLiteNodeAdapter)

const db = await PawSQLite.open("test", {
  adapter: 'PawSQLiteNodeAdapter'
});

await db.sql(`
  CREATE TABLE contacts (
    contact_id INTEGER PRIMARY KEY,
    first_name TEXT NOT NULL,
    last_name TEXT NOT NULL
  );
`);

const transaction = db.transaction();

console.log(await db.sql("SELECT * FROM contacts"));

await transaction.sql(
  "INSERT INTO contacts (first_name, last_name) VALUES (?, ?)",
  "John",
  "Lennon"
);

await transaction.commit();

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT