Skip to content

ria-com/node-mysql-query-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mysql-query-promise

mysql-query-js wrapper for promises

Installing

Add to you package.json file:

    "dependencies": {
       "mysql-query-promise": "*"
    }

Then run npm install...

Usage example

Add to your default.js config file:

    database: {
        'master': {
            host: 'localhost',
            user: 'username',
            password: 'password',
            port: '3306',
            database: 'database',
            connectionLimit: 10
        },
        'slave': {
            host: 'localhost',
            user: 'username',
            password: 'password',
            port: '3306',
            database: 'database',
            connectionLimit: 10
        }
    }

Then include and use:

    var query = require('mysql-query-promise'),
        qs = 'SELECT * FROM foo WHERE bar=?';
        
    query(qs, ['baz'], 'master')
        .then(function(rows){
            /* Do what you need with query results here */
        }, function(err){
            /* Errors handler */
        });

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published