A tiny mysql wrapper that adds capabilities of immutability, promises, and carefree connections management.
$ npm i -S finemysql
const mysql = require('../dist/index');
const db = new mysql({user: 'test', password: 'test', database: 'test'});
db.invoke('SELECT * FROM test')
.then(data=> {
console.log(data);
console.log(data.isList()); //immutable Data
console.log(data.first());
});
finemysql was created just to simplify the use of [nodejs driver for mysql][mysql]. it uses [bluebirdjs][] to convert old callbacks to promises, and [immutablejs][] to keep your data reliable and consistent throughout your app. all those, along with a done right connections management, allow you to use [mysql][] easier than ever before. Enjoy! [mysql]: https://www.npmjs.com/package/mysql [bluebirdjs]: http://bluebirdjs.com/docs/getting-started.html [immutablejs]: https://facebook.github.io/immutable-js/
Creates a new db instance.
const db = new mysql(options);
for the options list please refer to mysql module docs.
Name | Description | Syntax | Return Value |
---|---|---|---|
invoke() | Runs the query with the escapeArr on the db instance. | db.invoke(query, escapeArr = []); | A promise with the result (Immutable collection) (can also be rejected to the catch). |
for examples please look at the example page.