finemysql

A tiny mysql wrapper that adds capabilities of immutability, promises, and carefree connections management.

Usage no npm install needed!

<script type="module">
  import finemysql from 'https://cdn.skypack.dev/finemysql';
</script>

README

finemysql

Version npmNPM DownloadsDependencies

A tiny mysql wrapper that adds capabilities of immutability, promises, and carefree connections management.

Installation

$ npm i -S finemysql

Quick start

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());
    });

Goal

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/

API

DB Class require('finemysql')

initialize(constructor):

Creates a new db instance.

const db = new mysql(options);

for the options list please refer to mysql module docs.

Methods:

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).

Examples

for examples please look at the example page.

License

MIT