bauer-db

0.2.0 • Public • Published

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

Package Sidebar

Install

npm i bauer-db

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • yneves