bauer-db
v0.2.0
Published
Modern API for SQL databases.
Downloads
7
Readme
node-bauer-db
Modern API for SQL databases.
Currently supports sqlite3
and mysql
database.
Relies on bauer-sql for SQL building.
Installation
npm install bauer-db
Usage
var bauerDb = require("bauer-db");
SQLite3
var db = bauerDb.sqlite3({
database: "/path/to/db",
});
db.open();
db.select()
.from("sqlite_master")
.run()
.then(function(result) {
assert.deepEqual(result.rows,[]);
done();
})
.fail(function(error) {
done(error);
});
MySQL
var db = bauerDb.mysql({
host: "localhost",
port: 3306,
user: "root",
password: "1234",
database: "test",
});
db.open();
db.select()
.from("INFORMATION_SCHEMA.TABLES")
.run()
.then(function(result) {
assert.ok(result.rows.length > 0);
done();
})
.fail(function(error) {
done(error);
});
License
MIT