Update docs

This commit is contained in:
Timothy Warren 2014-10-27 10:35:44 -04:00
parent 06ea44ac8f
commit 81c7526bc6
15 changed files with 831 additions and 125 deletions

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -106,7 +110,7 @@ module.exports = {
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -234,7 +238,7 @@ module.exports = d;</pre>
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -167,7 +171,7 @@ module.exports = (function() {
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -160,7 +164,7 @@ module.exports = h;</pre>
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -126,7 +130,7 @@ query.select('foo')
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -350,7 +354,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -166,7 +170,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -682,7 +686,7 @@ function name, eg isNumber</p>
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -354,7 +358,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -305,7 +309,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-387">line 387</a> <a href="query-builder.js.html#sunlight-1-line-396">line 396</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -550,7 +554,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-719">line 719</a> <a href="query-builder.js.html#sunlight-1-line-738">line 738</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -741,7 +745,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-829">line 829</a> <a href="query-builder.js.html#sunlight-1-line-849">line 849</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -940,7 +944,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-807">line 807</a> <a href="query-builder.js.html#sunlight-1-line-827">line 827</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1141,7 +1145,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-791">line 791</a> <a href="query-builder.js.html#sunlight-1-line-811">line 811</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1332,7 +1336,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-818">line 818</a> <a href="query-builder.js.html#sunlight-1-line-838">line 838</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1427,7 +1431,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-334">line 334</a> <a href="query-builder.js.html#sunlight-1-line-343">line 343</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1574,7 +1578,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-601">line 601</a> <a href="query-builder.js.html#sunlight-1-line-620">line 620</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1661,7 +1665,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-700">line 700</a> <a href="query-builder.js.html#sunlight-1-line-719">line 719</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1748,7 +1752,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-664">line 664</a> <a href="query-builder.js.html#sunlight-1-line-683">line 683</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -1933,7 +1937,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-460">line 460</a> <a href="query-builder.js.html#sunlight-1-line-469">line 469</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2143,7 +2147,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-742">line 742</a> <a href="query-builder.js.html#sunlight-1-line-761">line 761</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2184,7 +2188,7 @@
<dt> <dt>
<h4 class="name" id="join"><span class="type-signature"></span>join<span class="signature">(joinOn, <span class="optional">cond</span>, joinTo, <span class="optional">type</span>)</span><span class="type-signature"></span></h4> <h4 class="name" id="join"><span class="type-signature"></span>join<span class="signature">(table, cond, <span class="optional">type</span>)</span><span class="type-signature"></span></h4>
</dt> </dt>
@ -2230,7 +2234,7 @@
<tr> <tr>
<td class="name"><code>joinOn</code></td> <td class="name"><code>table</code></td>
<td class="type"> <td class="type">
@ -2275,45 +2279,6 @@
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
'='
</td>
<td class="description last"><p>The join condition, eg. =,&lt;,&gt;,&lt;&gt;,!=,etc.</p></td>
</tr>
<tr>
<td class="name"><code>joinTo</code></td>
<td class="type">
<span class="param-type">String</span>
</td> </td>
@ -2332,7 +2297,7 @@
</td> </td>
<td class="description last"><p>The value of the condition you are joining on, whether another table's field, or a literal value</p></td> <td class="description last"><p>The join condition.</p></td>
</tr> </tr>
@ -2408,7 +2373,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-587">line 587</a> <a href="query-builder.js.html#sunlight-1-line-595">line 595</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2634,7 +2599,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-409">line 409</a> <a href="query-builder.js.html#sunlight-1-line-418">line 418</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -2813,7 +2778,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-652">line 652</a> <a href="query-builder.js.html#sunlight-1-line-671">line 671</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3039,7 +3004,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-422">line 422</a> <a href="query-builder.js.html#sunlight-1-line-431">line 431</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3230,7 +3195,7 @@
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-624">line 624</a> <a href="query-builder.js.html#sunlight-1-line-643">line 643</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3318,7 +3283,7 @@ prefixed with 'OR'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-677">line 677</a> <a href="query-builder.js.html#sunlight-1-line-696">line 696</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3503,7 +3468,7 @@ prefixed with 'OR'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-474">line 474</a> <a href="query-builder.js.html#sunlight-1-line-483">line 483</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3729,7 +3694,7 @@ prefixed with 'OR'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-435">line 435</a> <a href="query-builder.js.html#sunlight-1-line-444">line 444</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -3817,7 +3782,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-689">line 689</a> <a href="query-builder.js.html#sunlight-1-line-708">line 708</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4043,7 +4008,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-448">line 448</a> <a href="query-builder.js.html#sunlight-1-line-457">line 457</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4228,7 +4193,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-500">line 500</a> <a href="query-builder.js.html#sunlight-1-line-509">line 509</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4387,7 +4352,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-524">line 524</a> <a href="query-builder.js.html#sunlight-1-line-533">line 533</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4546,7 +4511,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-548">line 548</a> <a href="query-builder.js.html#sunlight-1-line-557">line 557</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4685,7 +4650,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-353">line 353</a> <a href="query-builder.js.html#sunlight-1-line-362">line 362</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -4867,7 +4832,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-560">line 560</a> <a href="query-builder.js.html#sunlight-1-line-569">line 569</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5077,7 +5042,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-759">line 759</a> <a href="query-builder.js.html#sunlight-1-line-779">line 779</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5262,7 +5227,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-488">line 488</a> <a href="query-builder.js.html#sunlight-1-line-497">line 497</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5421,7 +5386,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-512">line 512</a> <a href="query-builder.js.html#sunlight-1-line-521">line 521</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5580,7 +5545,7 @@ prefixed with 'OR NOT'</p>
<ul class="dummy"> <ul class="dummy">
<li> <li>
<a href="query-builder.js.html">query-builder.js</a>, <a href="query-builder.js.html">query-builder.js</a>,
<a href="query-builder.js.html#sunlight-1-line-536">line 536</a> <a href="query-builder.js.html#sunlight-1-line-545">line 545</a>
</li> </li>
</ul> </ul>
</dd> </dd>
@ -5644,7 +5609,7 @@ prefixed with 'OR NOT'</p>
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -0,0 +1,409 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DocStrap Module: query-parser</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cosmo.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="index.html">DocStrap</a>
<ul class="nav">
<li class="dropdown">
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="module-adapter.html">adapter</a>
</li>
<li>
<a href="module-driver.html">driver</a>
</li>
<li>
<a href="module-helpers.html">helpers</a>
</li>
<li>
<a href="module-node-query.html">node-query</a>
</li>
<li>
<a href="module-query-builder.html">query-builder</a>
</li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span8">
<div id="main">
<h1 class="page-title">Module: query-parser</h1>
<section>
<header>
<h2>
query-parser
</h2>
</header>
<article>
<div class="container-overview">
<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-54">line 54</a>
</li>
</ul>
</dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="compileJoin"><span class="type-signature"></span>compileJoin<span class="signature">(condition)</span><span class="type-signature"> &rarr; {String}</span></h4>
</dt>
<dd>
<div class="description">
<p>Return the output of the parsing of the join condition</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>condition</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>The join condition to evalate</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-parser.js.html">query-parser.js</a>,
<a href="query-parser.js.html#sunlight-1-line-70">line 70</a>
</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>The parsed/escaped join condition</li>
</ul>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
DocStrap Copyright © 2012-2014 The contributors to the JSDoc3 and DocStrap projects.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<div class="span3">
<div id="toc"></div>
</div>
<br clear="both">
</div>
</div>
<!--<script src="scripts/sunlight.js"></script>-->
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : "100px"
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
lang = "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
</body>
</html>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -154,7 +158,7 @@
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -125,7 +129,7 @@ module.exports = nodeQuery.init;</pre>
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

View File

@ -47,6 +47,10 @@
<a href="module-query-builder.html">query-builder</a> <a href="module-query-builder.html">query-builder</a>
</li> </li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul> </ul>
</li> </li>
@ -94,6 +98,8 @@ var QueryBuilder = function(driver, adapter) {
// That 'new' keyword is annoying // That 'new' keyword is annoying
if ( ! (this instanceof QueryBuilder)) return new QueryBuilder(driver, adapter); if ( ! (this instanceof QueryBuilder)) return new QueryBuilder(driver, adapter);
var parser = require('./query-parser')(driver);
/** /**
* "Private" methods * "Private" methods
* *
@ -141,9 +147,8 @@ var QueryBuilder = function(driver, adapter) {
switch(type) { switch(type) {
case "insert": case "insert":
var paramCount = state.setArrayKeys.length; var params = new Array(state.setArrayKeys.length);
var params = []; params.fill('?');
params.fill('?', 0, paramCount);
sql = "INSERT INTO " + table + " ("; sql = "INSERT INTO " + table + " (";
sql += state.setArrayKeys.join(','); sql += state.setArrayKeys.join(',');
@ -217,34 +222,38 @@ var QueryBuilder = function(driver, adapter) {
* *
* @private * @private
*/ */
mixedSet: function(/* varName, valType, key, [val] */) { mixedSet: function(/* $varName, $valType, $key, [$val] */) {
var args = getArgs('varName:string, valType:string, key:string|object, [val]:string|number|boolean', arguments); var args = getArgs('$varName:string, $valType:string, $key:object|string|number, [$val]', arguments);
var obj = {}; var obj = {};
if (helpers.isScalar(args.key) &amp;&amp; !helpers.isUndefined(args.val) &amp;&amp; !helpers.isNull(args.val)) if (helpers.isScalar(args.$key) &amp;&amp; !helpers.isUndefined(args.$val) &amp;&amp; !helpers.isNull(args.$val))
{ {
obj[args.key] = args.val; obj[args.$key] = args.$val;
}
else if ( ! helpers.isScalar(args.$key))
{
obj = args.$key;
} }
else else
{ {
obj = args.key; throw new Error("Invalid arguments passed");
} }
Object.keys(obj).forEach(function(k) { Object.keys(obj).forEach(function(k) {
// If a single value for the return // If a single value for the return
if (['key','value'].indexOf(args.valType) !== -1) if (['key','value'].indexOf(args.$valType) !== -1)
{ {
var pushVal = (args.valType === 'key') ? k : obj[k]; var pushVal = (args.$valType === 'key') ? k : obj[k];
state[args.varName].push(pushVal); state[args.$varName].push(pushVal);
} }
else else
{ {
state[args.varName][k] = obj[k]; state[args.$varName][k] = obj[k];
} }
}); });
return state[args.varName]; return state[args.$varName];
}, },
whereMixedSet: function(/*key, val*/) { whereMixedSet: function(/*key, val*/) {
var args = getArgs('key:string|object, [val]', arguments); var args = getArgs('key:string|object, [val]', arguments);
@ -263,12 +272,12 @@ var QueryBuilder = function(driver, adapter) {
Object.keys(state.whereMap).forEach(function(field) { Object.keys(state.whereMap).forEach(function(field) {
// Split each key by spaces, in case there // Split each key by spaces, in case there
// is an operator such as >, &lt;, !=, etc. // is an operator such as >, &lt;, !=, etc.
var fieldArray = field.split(' '); var fieldArray = field.trim().split(' ').map(helpers.stringTrim);
var item = driver.quoteIdentifiers(fieldArray[0]); var item = driver.quoteIdentifiers(fieldArray[0]);
// Simple key value, or an operator? // Simple key value, or an operator?
item += (fieldArray.length === 1) ? '=?' : " " + fieldArray[1] + " ?"; item += (fieldArray.length === 1 || fieldArray[1] === '') ? '=?' : " " + fieldArray[1] + " ?";
var firstItem = state.queryMap[0], var firstItem = state.queryMap[0],
lastItem = state.queryMap[state.queryMap.length - 1]; lastItem = state.queryMap[state.queryMap.length - 1];
@ -315,25 +324,29 @@ var QueryBuilder = function(driver, adapter) {
}); });
}); });
}, },
whereIn: function(key, val, inClause, conj) { whereIn: function(/*key, val, inClause, conj*/) {
key = driver.quoteIdentifiers(key); var args = getArgs('key:string, val:array, inClause:string, conj:string', arguments);
var params = [];
params.fill('?', 0, val.length);
val.forEach(function(value) { args.key = driver.quoteIdentifiers(args.key);
var params = new Array(args.val.length);
params.fill('?');
args.val.forEach(function(value) {
state.whereValues.push(value); state.whereValues.push(value);
}); });
conj = (state.queryMap.length > 0) ? " " + conj + " " : ' WHERE '; args.conj = (state.queryMap.length > 0) ? " " + args.conj + " " : ' WHERE ';
var str = key + " " + inClause + " (" + params.join(',') + ") "; var str = args.key + " " + args.inClause + " (" + params.join(',') + ") ";
_p.appendMap(conj, str, 'whereIn'); _p.appendMap(args.conj, str, 'whereIn');
}, },
run: function(type, table, callback, sql, vals) { run: function(type, table, callback, sql, vals) {
if ( ! sql) if ( ! sql)
{ {
sql = _p.compile(type, table); sql = _p.compile(type, table);
} }
//console.log(sql);
//console.log('------------------------');
if ( ! vals) if ( ! vals)
{ {
@ -628,12 +641,12 @@ var QueryBuilder = function(driver, adapter) {
* @param {String} [val] - The value if using a scalar key * @param {String} [val] - The value if using a scalar key
* @return this * @return this
*/ */
this.set = function(/* key, [val] */) { this.set = function(/* $key, [$val] */) {
var args = getArgs('key:string|object, [val]:string', arguments); var args = getArgs('$key, [$val]', arguments);
// Set the appropriate state variables // Set the appropriate state variables
_p.mixedSet('setArrayKeys', 'key', args.key, args.val); _p.mixedSet('setArrayKeys', 'key', args.$key, args.$val);
_p.mixedSet('values', 'value', args.key, args.val); _p.mixedSet('values', 'value', args.$key, args.$val);
// Use the keys of the array to make the insert/update string // Use the keys of the array to make the insert/update string
// and escape the field names // and escape the field names
@ -649,16 +662,26 @@ var QueryBuilder = function(driver, adapter) {
/** /**
* Add a join clause to the query * Add a join clause to the query
* *
* @param {String} joinOn - The table you are joining * @param {String} table - The table you are joining
* @param {String} [cond='='] - The join condition, eg. =,&lt;,>,&lt;>,!=,etc. * @param {String} cond - The join condition.
* @param {String} joinTo - The value of the condition you are joining on, whether another table's field, or a literal value
* @param {String} [type='inner'] - The type of join, which defaults to inner * @param {String} [type='inner'] - The type of join, which defaults to inner
* @return this * @return this
*/ */
this.join = function(/* joinOn, [cond='='], joinTo, [type='inner']*/) { this.join = function(table, cond, type) {
var args = getArgs('joinOn:string, [cond]:string, joinTo:string, [type]:string', arguments); type = type || "inner";
args.cond = args.cond || '=';
args.type = args.type || "inner"; // Prefix/quote table name
var table = table.split(' ').map(helpers.stringTrim);
table[0] = driver.quoteTable(table[0]);
table = table.map(driver.quoteIdentifiers);
table = table.join(' ');
// Parse out the join condition
var parsedCondition = parser.compileJoin(cond);
var condition = table + ' ON ' + parsedCondition;
// Append the join condition to the query map
_p.appendMap("\n" + type.toUpperCase() + ' JOIN ', condition, 'join');
return this; return this;
}; };
@ -810,13 +833,14 @@ var QueryBuilder = function(driver, adapter) {
* @param {Function} callback - Callback for handling response from the database * @param {Function} callback - Callback for handling response from the database
* @return void * @return void
*/ */
this.insert = function(table, data, callback) { this.insert = function(/* table, data, callback */) {
if (data) { var args = getArgs('table:string, [data]:object, callback:function', arguments);
this.set(data); if (args.data) {
this.set(args.data);
} }
// Run the query // Run the query
_p.run('insert', table, callback); _p.run('insert', args.table, args.callback);
}; };
/** /**
@ -925,7 +949,7 @@ module.exports = QueryBuilder;</pre>
<span class="jsdoc-message"> <span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Thu Oct 23rd 2014 using the <a on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>. href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span> </span>
</footer> </footer>

264
docs/query-parser.js.html Normal file
View File

@ -0,0 +1,264 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DocStrap Source: query-parser.js</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cosmo.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="index.html">DocStrap</a>
<ul class="nav">
<li class="dropdown">
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="module-adapter.html">adapter</a>
</li>
<li>
<a href="module-driver.html">driver</a>
</li>
<li>
<a href="module-helpers.html">helpers</a>
</li>
<li>
<a href="module-node-query.html">node-query</a>
</li>
<li>
<a href="module-query-builder.html">query-builder</a>
</li>
<li>
<a href="module-query-parser.html">query-parser</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div id="main">
<h1 class="page-title">Source: query-parser.js</h1>
<section>
<article>
<pre
class="sunlight-highlight-javascript linenums">'use strict';
var helpers = require('./helpers');
var matchPatterns = {
'function': /([a-zA-Z0-9_]+\((.*?)\))/i,
identifier: /([a-zA-Z0-9_\-]+\.?)+/ig,
operator: /\=|AND|&amp;&amp;?|~|\|\|?|\^|\/|>=?|&lt;=?|-|%|OR|\+|NOT|\!=?|&lt;>|XOR/i
};
// Full pattern for determining ordering of the pieces
matchPatterns.combined = new RegExp(matchPatterns['function'].source + "+|"
+ matchPatterns.identifier.source
+ '|(' + matchPatterns.operator.source + ')+', 'ig');
var filterMatches = function(array) {
var output = [];
// Return non-array matches
if (helpers.isScalar(array) || helpers.isNull(array) || helpers.isUndefined(array)) return output;
array.forEach(function(item) {
if ( ! helpers.isUndefined(item))
{
output.push(item);
}
});
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;
};
// --------------------------------------------------------------------------
/**
* @constructor
* @param {Driver} - The driver object for the database in use
* @module query-parser
*/
var QueryParser = function(driver) {
// That 'new' keyword is annoying
if ( ! (this instanceof QueryParser)) return new QueryParser(driver);
/**
* Return the output of the parsing of the join condition
*
* @param {String} condition - The join condition to evalate
* @return {String} - The parsed/escaped join condition
*/
this.compileJoin = function(condition) {
var parts = parseJoin(condition);
var count = parts.identifiers.length;
var i;
// Quote the identifiers
parts.combined.forEach(function(part, i) {
if (parts.identifiers.indexOf(part) !== -1 &amp;&amp; ! helpers.isNumber(part))
{
parts.combined[i] = driver.quoteIdentifiers(part);
}
});
return parts.combined.join('');
};
};
module.exports = QueryParser;
</pre>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
DocStrap Copyright © 2012-2014 The contributors to the JSDoc3 and DocStrap projects.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a>
on Mon Oct 27th 2014 using the <a
href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<br clear="both">
</div>
</div>
<!--<script src="scripts/sunlight.js"></script>-->
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : "100px"
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
// $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" );
$( ".tutorial-section pre, .readme-section pre" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
lang = "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : true,
showMenu : true,
enableDoclinks : true
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
</body>
</html>