q-sqlite3
The node-sqlite3 module wrapped with Q promises.
Getting Started
Install the module with: npm install q-sqlite3
Documentation
The API is functionally the same as node-sqlite3's API. The API methods supported can be found on the wiki.
These all run as promises. If the normal API would not call the callback with data, then the promise resolves to the database.
The only new method is createDatabase
, which serves as a promise-wrapped version of the Database
constructor; if successful, the promise resolves to the database instance. Otherwise the promise is rejected with the error sent as in node-sqlite3.
Examples
var QSQL = require('q-sqlite3');
var DB = null;
QSQL.createDatabase(':memory:').done(function(db) {
DB = db;
});
DB.run('INSERT INTO tbl (name) VALUES (?)', "foo").then(function(statement) {
// do stuff with statement here
});
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
- v0.0.1 - Initial release, only supports 3 basic query functions.
- v0.0.2 - Second release, add exec function.
-
v0.1.0 - Restructuring release. Methods are now exposed as they were in sqlite3, as part of a
Database
orStatement
object. -
v0.1.1 - Implement the basics of
Statement
s. -
v0.1.2 - Extend
Statement
methods.
License
Copyright (c) 2014 Eugene Bulkin. Licensed under the MIT license.