Update docs
This commit is contained in:
parent
7a3c5b7e79
commit
062273e411
@ -76,8 +76,7 @@
|
||||
class="sunlight-highlight-javascript linenums">"use strict";
|
||||
|
||||
/** @module helpers */
|
||||
|
||||
require('./es6-polyfill');
|
||||
require('es6-shim');
|
||||
|
||||
/** @alias module:helpers */
|
||||
var h = {
|
||||
|
@ -92,14 +92,14 @@
|
||||
|
||||
|
||||
<section class="readme-section">
|
||||
<article><h1>Node-query</h1><p>A node query builder for various SQL databases, based on CodeIgniter's query builder.</p>
|
||||
<article><h1>CI-Node-query</h1><p>A node query builder for various SQL databases, based on CodeIgniter's query builder.</p>
|
||||
<p><a href="https://travis-ci.org/timw4mail/node-query"><img src="https://travis-ci.org/timw4mail/node-query.svg?branch=master" alt="Build Status"></a></p>
|
||||
<h3>Supported adapters</h3><ul>
|
||||
<li>mysql</li>
|
||||
<li>mysql2</li>
|
||||
<li>pg</li>
|
||||
</ul>
|
||||
<h3>Basic use</h3><pre class="prettyprint source"><code>var nodeQuery = require('node-query');
|
||||
<h3>Installation</h3><pre class="prettyprint source"><code>npm install ci-node-query</code></pre><h3>Basic use</h3><pre class="prettyprint source"><code>var nodeQuery = require('ci-node-query');
|
||||
|
||||
var connection = ... // Database module connection
|
||||
|
||||
@ -115,7 +115,11 @@ query.select('foo')
|
||||
.limit(2, 3)
|
||||
.get(function(/* Adapter dependent arguments */) {
|
||||
// Database module result handling
|
||||
});</code></pre></article>
|
||||
});</code></pre><h3>Additional help</h3><ul>
|
||||
<li>Generated documentation is in the docs/ folder </li>
|
||||
<li><code>tests/query-builder-base.js</code> contains a lot of usage examples</li>
|
||||
<li>The <code>tests/adapters</code> folder contains examples of how to set up a connection for the appropriate database library</li>
|
||||
</ul></article>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -190,7 +190,7 @@ function name, eg isNumber</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="helpers.js.html">helpers.js</a>,
|
||||
<a href="helpers.js.html#sunlight-1-line-56">line 56</a>
|
||||
<a href="helpers.js.html#sunlight-1-line-55">line 55</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -311,7 +311,7 @@ function name, eg isNumber</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="helpers.js.html">helpers.js</a>,
|
||||
<a href="helpers.js.html#sunlight-1-line-47">line 47</a>
|
||||
<a href="helpers.js.html#sunlight-1-line-46">line 46</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -455,7 +455,7 @@ function name, eg isNumber</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="helpers.js.html">helpers.js</a>,
|
||||
<a href="helpers.js.html#sunlight-1-line-15">line 15</a>
|
||||
<a href="helpers.js.html#sunlight-1-line-14">line 14</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -605,7 +605,7 @@ function name, eg isNumber</p>
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="helpers.js.html">helpers.js</a>,
|
||||
<a href="helpers.js.html#sunlight-1-line-26">line 26</a>
|
||||
<a href="helpers.js.html#sunlight-1-line-25">line 25</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
@ -213,6 +213,216 @@
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="delete"><span class="type-signature"></span>delete<span class="signature">(table, <span class="optional">where</span>, callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Run the generated delete query</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>table</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>The table to insert into</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>where</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
<optional><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>Where clause for delete statement</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>callback</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">function</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>Callback for handling response from the database</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-800">line 800</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<p>void</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="from"><span class="type-signature"></span>from<span class="signature">(tableName)</span><span class="type-signature"></span></h4>
|
||||
|
||||
@ -745,7 +955,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-862">line 862</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-861">line 861</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -944,7 +1154,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-840">line 840</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-839">line 839</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1145,7 +1355,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-824">line 824</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-823">line 823</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -1336,7 +1546,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-851">line 851</a>
|
||||
<a href="query-builder.js.html#sunlight-1-line-850">line 850</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -5581,216 +5791,6 @@ prefixed with 'OR NOT'</p>
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="delete"><span class="type-signature"><inner> </span>delete<span class="signature">(table, <span class="optional">where</span>, callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Run the generated delete query</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>table</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>The table to insert into</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>where</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
<optional><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>Where clause for delete statement</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>callback</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">function</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td class="attributes">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"><p>Callback for handling response from the database</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-builder.js.html">query-builder.js</a>,
|
||||
<a href="query-builder.js.html#sunlight-1-line-792">line 792</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
<p>void</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
@ -113,7 +113,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-54">line 54</a>
|
||||
<a href="query-parser.js.html#sunlight-1-line-34">line 34</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -244,7 +244,7 @@
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-70">line 70</a>
|
||||
<a href="query-parser.js.html#sunlight-1-line-76">line 76</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
@ -294,6 +294,150 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="parseJoin"><span class="type-signature"></span>parseJoin<span class="signature">(sql)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Tokenize the sql into parts for additional processing</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Parameters:</h5>
|
||||
|
||||
|
||||
<table class="params table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th>Name</th>
|
||||
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="name"><code>sql</code></td>
|
||||
|
||||
|
||||
<td class="type">
|
||||
|
||||
|
||||
<span class="param-type">String</span>
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="description last"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="details">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source">
|
||||
<ul class="dummy">
|
||||
<li>
|
||||
<a href="query-parser.js.html">query-parser.js</a>,
|
||||
<a href="query-parser.js.html#sunlight-1-line-50">line 50</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">Object</span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
@ -867,13 +867,12 @@ var QueryBuilder = function(driver, adapter) {
|
||||
/**
|
||||
* Run the generated delete query
|
||||
*
|
||||
* @method delete
|
||||
* @param {String} table - The table to insert into
|
||||
* @param {Object} [where] - Where clause for delete statement
|
||||
* @param {Function} callback - Callback for handling response from the database
|
||||
* @return void
|
||||
*/
|
||||
this['delete'] = function (/*table, [where], callback*/) {
|
||||
this.delete = function (/*table, [where], callback*/) {
|
||||
var args = getArgs('table:string, [where], callback:function', arguments);
|
||||
|
||||
if (args.where)
|
||||
|
@ -104,26 +104,6 @@ var filterMatches = function(array) {
|
||||
return output;
|
||||
};
|
||||
|
||||
var parseJoin = function(sql) {
|
||||
var matches = {};
|
||||
var output = {};
|
||||
|
||||
// Get clause components
|
||||
matches['function'] = sql.match(matchPatterns['function']);
|
||||
matches.identifiers = sql.match(matchPatterns.identifier);
|
||||
matches.operators = sql.match(matchPatterns.operator);
|
||||
|
||||
// Get everything at once for ordering
|
||||
matches.combined = sql.match(matchPatterns.combined);
|
||||
|
||||
// Flatten the matches to increase relevance
|
||||
Object.keys(matches).forEach(function(key) {
|
||||
output[key] = filterMatches(matches[key]);
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -136,6 +116,32 @@ var QueryParser = function(driver) {
|
||||
// That 'new' keyword is annoying
|
||||
if ( ! (this instanceof QueryParser)) return new QueryParser(driver);
|
||||
|
||||
/**
|
||||
* Tokenize the sql into parts for additional processing
|
||||
*
|
||||
* @param {String} sql
|
||||
* @return {Object}
|
||||
*/
|
||||
this.parseJoin = function(sql) {
|
||||
var matches = {};
|
||||
var output = {};
|
||||
|
||||
// Get clause components
|
||||
matches['function'] = sql.match(matchPatterns['function']);
|
||||
matches.identifiers = sql.match(matchPatterns.identifier);
|
||||
matches.operators = sql.match(matchPatterns.operator);
|
||||
|
||||
// Get everything at once for ordering
|
||||
matches.combined = sql.match(matchPatterns.combined);
|
||||
|
||||
// Flatten the matches to increase relevance
|
||||
Object.keys(matches).forEach(function(key) {
|
||||
output[key] = filterMatches(matches[key]);
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the output of the parsing of the join condition
|
||||
*
|
||||
@ -143,7 +149,7 @@ var QueryParser = function(driver) {
|
||||
* @return {String} - The parsed/escaped join condition
|
||||
*/
|
||||
this.compileJoin = function(condition) {
|
||||
var parts = parseJoin(condition);
|
||||
var parts = this.parseJoin(condition);
|
||||
var count = parts.identifiers.length;
|
||||
var i;
|
||||
|
||||
|
3
node_modules/async/.travis.yml
generated
vendored
Normal file
3
node_modules/async/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
19
node_modules/async/LICENSE
generated
vendored
Normal file
19
node_modules/async/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
1646
node_modules/async/README.md
generated
vendored
Normal file
1646
node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
node_modules/async/component.json
generated
vendored
Normal file
11
node_modules/async/component.json
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "async",
|
||||
"repo": "caolan/async",
|
||||
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||
"version": "0.1.23",
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"main": "lib/async.js",
|
||||
"scripts": [ "lib/async.js" ]
|
||||
}
|
1123
node_modules/async/lib/async.js
generated
vendored
Executable file
1123
node_modules/async/lib/async.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
45
node_modules/async/package.json
generated
vendored
Normal file
45
node_modules/async/package.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user