README
node-nor-db
Generic (MySQL) Database Library for Node.js.
Features
- Uses extended Q-promises that support method chaining.
TODO
MySQL.prototype.select
,MySQL.prototype.update
,MySQL.prototype.insert
,MySQL.prototype.delete
- Unit tests
- Travis-CI
- PostgreSQL support
Example
var db = new require('nor-db').MySQL({'database':'test'});
db.connect().query('INSERT INTO user SET created=NOW(), updated=NOW(), ?', {'name':'bob'}).then(function(res) {
var ret = db.query('SELECT * FROM user LIMIT 1').shift().then(function(user) {
console.log(JSON.stringify(user));
});
return ret;
}).end().fail(function(err) {
console.error('ERROR: ' + err);
console.error(err.stack);
}).done();
Method reference
db.MySQL
The MySQL connection object constructor.