node-query/README.md

24 lines
545 B
Markdown
Raw Normal View History

2014-10-20 16:56:45 -04:00
#Node-query
A node query builder for various SQL databases, based on CodeIgniter's query builder.
2014-10-23 10:53:16 -04:00
### Basic use
2014-10-20 16:56:45 -04:00
2014-10-23 10:53:16 -04:00
var nodeQuery = require('node-query');
var mysql = ... // Database module connection
// Three arguments: database type, database connection, database connection library
var query = nodeQuery('mysql', mysql, 'mysql2');
2014-10-20 16:56:45 -04:00
2014-10-23 10:53:16 -04:00
query.select('foo')
2014-10-20 16:56:45 -04:00
.from('bar')
.where('x', 3)
.orWhere('y', 2)
.orderBy('x')
.limit(2, 3)
2014-10-23 10:53:16 -04:00
.get(function(err, result) {
// Database module result handling
});
2014-10-20 16:56:45 -04:00