Skip to content

Repository files navigation

sqlite

🚧 A Work in Progress. Do Not Use 🚧

Build Status

An experimental SQLite library for Node using Neon

Goals

  • APIs
    • Query binding
    • Connection creation and closing
    • Connection pooling
    • Parallel queries
    • Serialization
    • Traces and profiling
    • Interrupting queries
    • Exporting a database
  • Modern infrastructure
  • Target latest node and electron versions
  • Promise based API
  • Blob support
  • ESNext BigInt support
  • SQLite extensions support
  • Typescript support
  • Query caching support
  • Extensive documentation and examples using docusarus, guides and examples
  • Bundle sqlite if system does not have it installed
  • Support for larger subset of SQLite API (compared to node-sqlite3)
  • Better performance (compared to node-sqlite3)

Ideal API

importSqlitefrom'@sqlite/sqlite';constconnector=newSqlite();// Creating a regular async connectionconstconn=awaitconnection.open({database: '/path/to/database',// ':memory:'verbose: true// process.env.NODE_ENV !== 'production'});// Parallel queriesawaitPromise.all([conn.run('SELECT * FROM users'),conn.run('UPDATE tbl SET name = ? WHERE email = ?','bar',2)]);// Statement curryingconstupdateTables=awaitdb.statement('UPDATE tbl SET name = ? WHERE email = ?');constresult=awaitupdateTables('john','john@gmail.com');console.log(result);// Batching queriesconstupdateTables=awaitdb.batch(` ATTACH DATABASE ':memory:' AS my_attached; BEGIN; CREATE TABLE my_attached.foo(x INTEGER); INSERT INTO my_attached.foo VALUES(42); END `;);constupdateTables=awaitdb.batch(['ATTACH DATABASE ':memory:' AS my_attached;','BEGIN;','CREATE TABLE my_attached.foo(x INTEGER);','INSERT INTO my_attached.foo VALUES(42);','END']);

Local Development

git clone https://github.com/sqlite-js/sqlite
cd sqlite
yarn
yarn test

Prior art

Yarn wouldn't exist if it wasn't for excellent prior art. Sqlite has been inspired by the following projects:

About

An experimental SQLite library for Node using Neon

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages