diff --git a/API.md b/API.md index 70e758d..a188d98 100644 --- a/API.md +++ b/API.md @@ -1,10 +1,63 @@ +# limit + +Set the limit clause + +**Parameters** + +- `sql` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** SQL statement to modify +- `limit` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Maximum number of rows to fetch +- `offset` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Number of rows to skip + +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Modified SQL statement + +# quoteTable + +Quote database table name, and set prefix + +**Parameters** + +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Table name to quote + +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Quoted table name + +# quoteIdentifiers + +Use the driver's escape character to quote identifiers + +**Parameters** + +- `str` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))** String or array of strings to quote identifiers + +Returns **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))** Quoted identifier(s) + +# truncate + +Generate SQL to truncate the passed table + +**Parameters** + +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Table to truncate + +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Truncation SQL + +# insertBatch + +Generate SQL to insert a group of rows + +**Parameters** + +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The table to insert to +- `data` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)]** The array of object containing data to insert + +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Query and data to insert + # NodeQuery Class for connection management **Parameters** -- `config` **object** connection parameters +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** connection parameters ## constructor @@ -12,7 +65,7 @@ Constructor **Parameters** -- `config` **object** connection parameters +- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** connection parameters **Examples** @@ -39,10 +92,12 @@ let nodeQuery = require('ci-node-query')({ Return an existing query builder instance -Returns **QueryBuilder** The Query Builder object +Returns **[QueryBuilder](#querybuilder)** The Query Builder object # QueryBuilder +**Extends QueryBuilderBase** + Main object that builds SQL queries. **Parameters** @@ -50,17 +105,34 @@ Main object that builds SQL queries. - `Driver` **Driver** The syntax driver for the database - `Adapter` **Adapter** The database module adapter for running queries -## delete +## query -Run the generated delete query +Run an arbitrary sql query. Run as a prepared statement. **Parameters** -- `table` **String** The table to insert into -- `where` **[Object]** Where clause for delete statement -- `callback` **[Function]** Callback for handling response from the database +- `sql` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The sql to execute +- `params` **\[[array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)]** The query parameters +- `callback` **\[[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Optional callback -Returns **void or Promise** If no callback is passed, a promise is returned +Returns **(void | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise))** Returns a promise if no callback is supplied + +## resetQuery + +Reset the object state for a new query + +Returns **void** + +## truncate + +Empties the selected database table + +**Parameters** + +- `table` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the table to truncate +- `callback` **\[[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Optional callback + +Returns **(void | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise))** Returns a promise if no callback is supplied ## end @@ -68,13 +140,33 @@ Closes the database connection for the current adapter Returns **void** +## select + +Specify rows to select in the query + +**Parameters** + +- `fields` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))** The fields to select from the current table + +**Examples** + +```javascript +query.select('foo, bar'); // Select multiple fields with a string +``` + +```javascript +query.select(['foo', 'bar']); // Select multiple fileds with an array +``` + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + ## from Specify the database table to select from **Parameters** -- `tableName` **String** The table to use for the current query +- `tableName` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The table to use for the current query **Examples** @@ -86,7 +178,274 @@ query.from('tableName'); query.from('tableName t'); // Select the table with an alias ``` -Returns **QueryBuilder** The Query Builder object, for chaining +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## like + +Add a 'like/ and like' clause to the query + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the field to compare to +- `val` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The value to compare to +- `pos` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## notLike + +Add a 'not like/ and not like' clause to the query + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the field to compare to +- `val` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The value to compare to +- `pos` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orLike + +Add an 'or like' clause to the query + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the field to compare to +- `val` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The value to compare to +- `pos` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orNotLike + +Add an 'or not like' clause to the query + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the field to compare to +- `val` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The value to compare to +- `pos` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## having + +Add a 'having' clause + +**Parameters** + +- `key` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** The name of the field and the comparision operator, or an object +- `val` **\[([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))]** The value to compare if the value of key is a string + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orHaving + +Add an 'or having' clause + +**Parameters** + +- `key` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** The name of the field and the comparision operator, or an object +- `val` **\[([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))]** The value to compare if the value of key is a string + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## where + +Set a 'where' clause + +**Parameters** + +- `key` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** The name of the field and the comparision operator, or an object +- `val` **\[([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))]** The value to compare if the value of key is a string + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orWhere + +Set a 'or where' clause + +**Parameters** + +- `key` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** The name of the field and the comparision operator, or an object +- `val` **\[([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))]** The value to compare if the value of key is a string + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## whereIsNull + +Select a field that is Null + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the field that has a NULL value + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## whereIsNotNull + +Specify that a field IS NOT NULL + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name so the field that is not to be null + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orWhereIsNull + +Field is null prefixed with 'OR' + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the field + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orWhereIsNotNull + +Field is not null prefixed with 'OR' + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the field + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## whereIn + +Set a 'where in' clause + +**Parameters** + +- `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the field to search +- `values` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the array of items to search in + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orWhereIn + +Set a 'or where in' clause + +**Parameters** + +- `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the field to search +- `values` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the array of items to search in + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## whereNotIn + +Set a 'where not in' clause + +**Parameters** + +- `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the field to search +- `values` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the array of items to search in + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orWhereNotIn + +Set a 'or where not in' clause + +**Parameters** + +- `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the field to search +- `values` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the array of items to search in + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## set + +Set values for insertion or updating + +**Parameters** + +- `key` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** The key or object to use +- `val` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The value if using a scalar key + +**Examples** + +```javascript +query.set('foo', 'bar'); // Set a key, value pair +``` + +```javascript +query.set({foo:'bar'}); // Set with an object +``` + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## join + +Add a join clause to the query + +**Parameters** + +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The table you are joining +- `cond` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The join condition. +- `type` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The type of join, which defaults to inner (optional, default `'inner'`) + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## groupBy + +Group the results by the selected field(s) + +**Parameters** + +- `field` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array))** The name of the field to group by + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orderBy + +Order the results by the selected field(s) + +**Parameters** + +- `field` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The field(s) to order by +- `type` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The order direction, ASC or DESC (optional, default `'ASC'`) + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## limit + +Put a limit on the query + +**Parameters** + +- `limit` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** The maximum number of rows to fetch +- `offset` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** The row number to start from + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## groupStart + +Adds an open paren to the current query for logical grouping + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orGroupStart + +Adds an open paren to the current query for logical grouping, +prefixed with 'OR' + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## orNotGroupStart + +Adds an open paren to the current query for logical grouping, +prefixed with 'OR NOT' + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining + +## groupEnd + +Ends a logical grouping started with one of the groupStart methods + +Returns **[QueryBuilder](#querybuilder)** The Query Builder object, for chaining ## get @@ -94,10 +453,10 @@ Get the results of the compiled query **Parameters** -- `table` **[String]** The table to select from -- `limit` **[Number]** A limit for the query -- `offset` **[Number]** An offset for the query -- `callback` **[Function]** A callback for receiving the result +- `table` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** The table to select from +- `limit` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** A limit for the query +- `offset` **\[[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** An offset for the query +- `callback` **\[[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** A callback for receiving the result **Examples** @@ -113,84 +472,7 @@ query.get('table_name', 5, callback); // Get 5 rows from the table query.get(callback); // Get the results of a query generated with other methods ``` -Returns **void or Promise** If no callback is passed, a promise is returned - -## getCompiledDelete - -Return generated delete query SQL - -**Parameters** - -- `table` **String** the name of the table to delete from -- `reset` **[Boolean]** Whether to reset the query builder so another query can be built (optional, default `true`) - -Returns **String** The compiled sql statement - -## getCompiledInsert - -Return generated insert query SQL - -**Parameters** - -- `table` **String** the name of the table to insert into -- `reset` **[Boolean]** Whether to reset the query builder so another query can be built (optional, default `true`) - -Returns **String** The compiled sql statement - -## getCompiledSelect - -Return generated select query SQL - -**Parameters** - -- `table` **[String]** the name of the table to retrieve from -- `reset` **[Boolean]** Whether to reset the query builder so another query can be built (optional, default `true`) - -Returns **String** The compiled sql statement - -## getCompiledUpdate - -Return generated update query SQL - -**Parameters** - -- `table` **String** the name of the table to update -- `reset` **[Boolean]** Whether to reset the query builder so another query can be built (optional, default `true`) - -Returns **String** The compiled sql statement - -## groupBy - -Group the results by the selected field(s) - -**Parameters** - -- `field` **String or Array** The name of the field to group by - -Returns **QueryBuilder** The Query Builder object, for chaining - -## groupEnd - -Ends a logical grouping started with one of the groupStart methods - -Returns **QueryBuilder** The Query Builder object, for chaining - -## groupStart - -Adds an open paren to the current query for logical grouping - -Returns **QueryBuilder** The Query Builder object, for chaining - -## having - -Add a 'having' clause - -**Parameters** - -- `key` **String or Object** The name of the field and the comparision operator, or an object -- `val` **[String or Number]** The value to compare if the value of key is a string - -Returns **QueryBuilder** The Query Builder object, for chaining +Returns **(void | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise))** If no callback is passed, a promise is returned ## insert @@ -198,11 +480,11 @@ Run the generated insert query **Parameters** -- `table` **String** The table to insert into -- `data` **[Object]** Data to insert, if not already added with the 'set' method -- `callback` **[Function]** Callback for handling response from the database +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The table to insert into +- `data` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Data to insert, if not already added with the 'set' method +- `callback` **\[[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Callback for handling response from the database -Returns **void or Promise** If no callback is passed, a promise is returned +Returns **(void | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise))** If no callback is passed, a promise is returned ## insertBatch @@ -210,9 +492,9 @@ Insert multiple sets of rows at a time **Parameters** -- `table` **String** The table to insert into -- `data` **Array** The array of objects containing data rows to insert -- `callback` **[Function]** Callback for handling database response +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The table to insert into +- `data` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The array of objects containing data rows to insert +- `callback` **\[[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Callback for handling database response **Examples** @@ -225,237 +507,7 @@ query.insertBatch('foo',[{id:1,val:'bar'},{id:2,val:'baz'}]) .then(promiseCallback); ``` -Returns **void or Promise** If no callback is passed, a promise is returned - -## join - -Add a join clause to the query - -**Parameters** - -- `table` **String** The table you are joining -- `cond` **String** The join condition. -- `type` **[String]** The type of join, which defaults to inner (optional, default `'inner'`) - -Returns **QueryBuilder** The Query Builder object, for chaining - -## like - -Add a 'like/ and like' clause to the query - -**Parameters** - -- `field` **String** The name of the field to compare to -- `val` **String** The value to compare to -- `pos` **[String]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) - -Returns **QueryBuilder** The Query Builder object, for chaining - -## limit - -Put a limit on the query - -**Parameters** - -- `limit` **Number** The maximum number of rows to fetch -- `offset` **[Number]** The row number to start from - -Returns **QueryBuilder** The Query Builder object, for chaining - -## notLike - -Add a 'not like/ and not like' clause to the query - -**Parameters** - -- `field` **String** The name of the field to compare to -- `val` **String** The value to compare to -- `pos` **[String]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orGroupStart - -Adds an open paren to the current query for logical grouping, -prefixed with 'OR' - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orHaving - -Add an 'or having' clause - -**Parameters** - -- `key` **String or Object** The name of the field and the comparision operator, or an object -- `val` **[String or Number]** The value to compare if the value of key is a string - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orLike - -Add an 'or like' clause to the query - -**Parameters** - -- `field` **String** The name of the field to compare to -- `val` **String** The value to compare to -- `pos` **[String]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orNotGroupStart - -Adds an open paren to the current query for logical grouping, -prefixed with 'OR NOT' - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orNotLike - -Add an 'or not like' clause to the query - -**Parameters** - -- `field` **String** The name of the field to compare to -- `val` **String** The value to compare to -- `pos` **[String]** The placement of the wildcard character(s): before, after, or both (optional, default `both`) - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orWhere - -Set a 'or where' clause - -**Parameters** - -- `key` **String or Object** The name of the field and the comparision operator, or an object -- `val` **[String or Number]** The value to compare if the value of key is a string - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orWhereIn - -Set a 'or where in' clause - -**Parameters** - -- `key` **String** the field to search -- `values` **Array** the array of items to search in - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orWhereIsNotNull - -Field is not null prefixed with 'OR' - -**Parameters** - -- `field` **String** The name of the field - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orWhereIsNull - -Field is null prefixed with 'OR' - -**Parameters** - -- `field` **String** The name of the field - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orWhereNotIn - -Set a 'or where not in' clause - -**Parameters** - -- `key` **String** the field to search -- `values` **Array** the array of items to search in - -Returns **QueryBuilder** The Query Builder object, for chaining - -## orderBy - -Order the results by the selected field(s) - -**Parameters** - -- `field` **String** The field(s) to order by -- `type` **[String]** The order direction, ASC or DESC (optional, default `'ASC'`) - -Returns **QueryBuilder** The Query Builder object, for chaining - -## query - -Run an arbitrary sql query. Run as a prepared statement. - -**Parameters** - -- `sql` **string** The sql to execute -- `params` **[array]** The query parameters -- `callback` **[function]** Optional callback - -Returns **void or Promise** Returns a promise if no callback is supplied - -## resetQuery - -Reset the object state for a new query - -Returns **void** - -## select - -Specify rows to select in the query - -**Parameters** - -- `fields` **String or Array** The fields to select from the current table - -**Examples** - -```javascript -query.select('foo, bar'); // Select multiple fields with a string -``` - -```javascript -query.select(['foo', 'bar']); // Select multiple fileds with an array -``` - -Returns **QueryBuilder** The Query Builder object, for chaining - -## set - -Set values for insertion or updating - -**Parameters** - -- `key` **String or Object** The key or object to use -- `val` **[String]** The value if using a scalar key - -**Examples** - -```javascript -query.set('foo', 'bar'); // Set a key, value pair -``` - -```javascript -query.set({foo:'bar'}); // Set with an object -``` - -Returns **QueryBuilder** The Query Builder object, for chaining - -## truncate - -Empties the selected database table - -**Parameters** - -- `table` **string** the name of the table to truncate -- `callback` **[function]** Optional callback - -Returns **void or Promise** Returns a promise if no callback is supplied +Returns **(void | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise))** If no callback is passed, a promise is returned ## update @@ -463,64 +515,67 @@ Run the generated update query **Parameters** -- `table` **String** The table to insert into -- `data` **[Object]** Data to insert, if not already added with the 'set' method -- `callback` **[Function]** Callback for handling response from the database +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The table to insert into +- `data` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Data to insert, if not already added with the 'set' method +- `callback` **\[[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Callback for handling response from the database -Returns **void or Promise** If no callback is passed, a promise is returned +Returns **(void | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise))** If no callback is passed, a promise is returned -## where +## delete -Set a 'where' clause +Run the generated delete query **Parameters** -- `key` **String or Object** The name of the field and the comparision operator, or an object -- `val` **[String or Number]** The value to compare if the value of key is a string +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The table to insert into +- `where` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** Where clause for delete statement +- `callback` **\[[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** Callback for handling response from the database -Returns **QueryBuilder** The Query Builder object, for chaining +Returns **(void | [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise))** If no callback is passed, a promise is returned -## whereIn +## getCompiledSelect -Set a 'where in' clause +Return generated select query SQL **Parameters** -- `key` **String** the field to search -- `values` **Array** the array of items to search in +- `table` **\[[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** the name of the table to retrieve from +- `reset` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Whether to reset the query builder so another query can be built (optional, default `true`) -Returns **QueryBuilder** The Query Builder object, for chaining +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The compiled sql statement -## whereIsNotNull +## getCompiledInsert -Specify that a field IS NOT NULL +Return generated insert query SQL **Parameters** -- `field` **String** The name so the field that is not to be null +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the table to insert into +- `reset` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Whether to reset the query builder so another query can be built (optional, default `true`) -Returns **QueryBuilder** The Query Builder object, for chaining +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The compiled sql statement -## whereIsNull +## getCompiledUpdate -Select a field that is Null +Return generated update query SQL **Parameters** -- `field` **String** The name of the field that has a NULL value +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the table to update +- `reset` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Whether to reset the query builder so another query can be built (optional, default `true`) -Returns **QueryBuilder** The Query Builder object, for chaining +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The compiled sql statement -## whereNotIn +## getCompiledDelete -Set a 'where not in' clause +Return generated delete query SQL **Parameters** -- `key` **String** the field to search -- `values` **Array** the array of items to search in +- `table` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the name of the table to delete from +- `reset` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** Whether to reset the query builder so another query can be built (optional, default `true`) -Returns **QueryBuilder** The Query Builder object, for chaining +Returns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The compiled sql statement # Result @@ -528,17 +583,17 @@ Query result object **Parameters** -- `rows` **Array** the data rows of the result -- `columns` **Array** the column names in the result - -## columnCount - -Get the number of columns returned by the query - -Returns **Number** the number of columns in the result +- `rows` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the data rows of the result +- `columns` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** the column names in the result ## rowCount Get the number of rows returned by the query -Returns **Number** the number of rows in the result +Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the number of rows in the result + +## columnCount + +Get the number of columns returned by the query + +Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the number of columns in the result diff --git a/README.md b/README.md index 5eaefcc..161466d 100755 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ query.select('foo') }); // As of version 3.1.0, you can also get promises -var queryPromise = query.select('foo') +const queryPromise = query.select('foo') .from('bar') .where('x', 3) .orWhere({y: 2}) @@ -93,5 +93,5 @@ As of version 2, `where` and `having` type methods parse the values passed to lo * Generated documentation is in the docs/ folder * The API is documented in [API.md](./API.md) * The `tests/adapters` folder contains examples of how to set up a connection for the appropriate database library -* The documentation generated for the latest dev build is also [Available](https://github.timshomepage.net/node-query/docs/) +* The documentation generated for the latest dev build is also [Available](https://github.timshomepage.net/node-query/docs/index.html) diff --git a/docs/assets/bass-addons.css b/docs/assets/bass-addons.css new file mode 100644 index 0000000..c27e96d --- /dev/null +++ b/docs/assets/bass-addons.css @@ -0,0 +1,12 @@ +.input { + font-family: inherit; + display: block; + width: 100%; + height: 2rem; + padding: .5rem; + margin-bottom: 1rem; + border: 1px solid #ccc; + font-size: .875rem; + border-radius: 3px; + box-sizing: border-box; +} diff --git a/docs/assets/bass.css b/docs/assets/bass.css old mode 100755 new mode 100644 index 941c260..15e0dc9 --- a/docs/assets/bass.css +++ b/docs/assets/bass.css @@ -1,850 +1,543 @@ -/* +/*! Basscss | http://basscss.com | MIT License */ - Basscss v7.0.3 - Low-level CSS toolkit - http://basscss.com +.h1{ font-size: 2rem } +.h2{ font-size: 1.5rem } +.h3{ font-size: 1.25rem } +.h4{ font-size: 1rem } +.h5{ font-size: .875rem } +.h6{ font-size: .75rem } - 14.88 kB - 3.38 kB Gzipped - 286 Rules - 328 Selectors - 441 Declarations - 95 Properties +.font-family-inherit{ font-family:inherit } +.font-size-inherit{ font-size:inherit } +.text-decoration-none{ text-decoration:none } -*/ +.bold{ font-weight: bold; font-weight: bold } +.regular{ font-weight:normal } +.italic{ font-style:italic } +.caps{ text-transform:uppercase; letter-spacing: .2em; } +.left-align{ text-align:left } +.center{ text-align:center } +.right-align{ text-align:right } +.justify{ text-align:justify } +.nowrap{ white-space:nowrap } +.break-word{ word-wrap:break-word } -body { margin: 0 } -img { max-width: 100% } -svg { max-height: 100% } +.line-height-1{ line-height: 1 } +.line-height-2{ line-height: 1.125 } +.line-height-3{ line-height: 1.25 } +.line-height-4{ line-height: 1.5 } -input, -select, -textarea, -fieldset { - font-family: inherit; - font-size: 1rem; - box-sizing: border-box; - margin-top: 0; - margin-bottom: 0; +.list-style-none{ list-style:none } +.underline{ text-decoration:underline } + +.truncate{ + max-width:100%; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; } -label { - vertical-align: middle; +.list-reset{ + list-style:none; + padding-left:0; } -input[type=text], -input[type=date], -input[type=datetime], -input[type=datetime-local], -input[type=email], -input[type=month], -input[type=number], -input[type=password], -input[type=search], -input[type=tel], -input[type=time], -input[type=url], -input[type=week] { - height: 2.25rem; - padding: .5rem .5rem; - vertical-align: middle; - -webkit-appearance: none; -} +.inline{ display:inline } +.block{ display:block } +.inline-block{ display:inline-block } +.table{ display:table } +.table-cell{ display:table-cell } -select { - line-height: 1.75; - padding: .5rem .5rem; -} - -select:not([multiple]) { - height: 2.25rem; - vertical-align: middle; -} - -textarea { - line-height: 1.75; - padding: .5rem .5rem; -} - -table { - border-collapse: separate; - border-spacing: 0; - max-width: 100%; - width: 100%; -} - -th { - text-align: left; - font-weight: bold; -} - -th, -td { - padding: .25rem 1rem; - line-height: inherit; -} - -th { vertical-align: bottom } -td { vertical-align: top } - -body { - font-family: 'Helvetica Neue', Helvetica, sans-serif; - line-height: 1.5; - font-size: 100%; -} - -h1, h2, h3, h4, h5, h6 { - font-family: 'Helvetica Neue', Helvetica, sans-serif; - font-weight: bold; - line-height: 1.25; - margin-top: 1em; - margin-bottom: .5em; -} - -p { - margin-top: 0; - margin-bottom: 1rem; -} - -dl, ol, ul { - margin-top: 0; - margin-bottom: 1rem; -} - -pre, code, samp { - font-family: 'Source Code Pro', Consolas, monospace; - font-size: inherit; -} - -pre { - margin-top: 0; - margin-bottom: 1rem; - overflow-x: scroll; -} - -h1 { font-size: 2rem } -h2 { font-size: 1.5rem } -h3 { font-size: 1.25rem } -h4 { font-size: 1rem } -h5 { font-size: .875rem } -h6 { font-size: .75rem } - -body { - color: #111; - background-color: #fff; -} - -a { - color: #0074d9; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -pre, code { - background-color: transparent; - border-radius: 3px; -} - -hr { - border: 0; - border-bottom-style: solid; - border-bottom-width: 1px; - border-bottom-color: rgba(0,0,0,.125); -} - -.field { - border-style: solid; - border-width: 1px; - border-color: rgba(0,0,0,.125); - border-radius: 3px; -} - -.field:focus, -.field.is-focused { - outline: none; - border-color: #0074d9; - box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.5); -} - -.field:disabled, -.field.is-disabled { - background-color: rgba(0,0,0,.125); - opacity: .5; -} - -.field:read-only:not(select), -.field.is-read-only { - background-color: rgba(0,0,0,.125); -} - - -.field.is-success { - border-color: #2ecc40; -} - -.field.is-success:focus, -.field.is-success.is-focused { - box-shadow: 0 0 0 2px rgba(46, 204, 64, 0.5); -} - -.field.is-warning { - border-color: #ffdc00; -} - -.field.is-warning:focus, -.field.is-warning.is-focused { - box-shadow: 0 0 0 2px rgba(255, 220, 0, 0.5); -} - -.field:invalid, -.field.is-error { - border-color: #ff4136; -} - -.field:invalid:focus, -.field:invalid.is-focused, -.field.is-error:focus, -.field.is-error.is-focused { - box-shadow: 0 0 0 2px rgba(255, 65, 54, 0.5); -} - -.table-light th, -.table-light td { - border-bottom-width: 1px; - border-bottom-style: solid; - border-bottom-color: rgba(0,0,0,.125); -} - -.table-light tr:last-child td { - border-bottom: 0; -} - -.btn { - font-family: inherit; - font-size: inherit; - font-weight: bold; - text-decoration: none; - cursor: pointer; - display: inline-block; - line-height: 1.125rem; - padding: .5rem 1rem; - margin: 0; - height: auto; - border: 1px solid transparent; - vertical-align: middle; - -webkit-appearance: none; - color: inherit; - background-color: transparent; -} - -.btn:hover { - text-decoration: none; -} - -.btn:focus { - outline: none; - border-color: rgba(0,0,0,.125); - box-shadow: 0 0 0 3px rgba(0,0,0,.25); -} - -::-moz-focus-inner { - border: 0; - padding: 0; -} - -.btn-primary { - color: #fff; - background-color: #0074d9; - border-radius: 3px; -} - -.btn-primary:hover { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.0625); -} - -.btn-primary:active { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.125), - inset 0 3px 4px 0 rgba(0,0,0,.25), - 0 0 1px rgba(0,0,0,.125); -} - -.btn-primary:disabled, -.btn-primary.is-disabled { - opacity: .5; -} - -.btn-outline, -.btn-outline:hover { - border-color: currentcolor; -} - -.btn-outline { - border-radius: 3px; -} - -.btn-outline:hover { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.0625); -} - -.btn-outline:active { - box-shadow: inset 0 0 0 20rem rgba(0,0,0,.125), - inset 0 3px 4px 0 rgba(0,0,0,.25), - 0 0 1px rgba(0,0,0,.125); -} - -.btn-outline:disabled, -.btn-outline.is-disabled { - opacity: .5; -} - -.h1 { font-size: 2rem } -.h2 { font-size: 1.5rem } -.h3 { font-size: 1.25rem } -.h4 { font-size: 1rem } -.h5 { font-size: .875rem } -.h6 { font-size: .75rem } - -.bold { font-weight: bold } -.regular { font-weight: normal } -.italic { font-style: italic } -.caps { text-transform: uppercase; letter-spacing: .2em; } - -.left-align { text-align: left } -.center { text-align: center } -.right-align { text-align: right } -.justify { text-align: justify } - -.nowrap { white-space: nowrap } -.break-word { word-wrap: break-word } - -.truncate { - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.list-reset { - list-style: none; - padding-left: 0; -} - -.inline { display: inline } -.block { display: block } -.inline-block { display: inline-block } -.table { display: table } -.table-cell { display: table-cell } - -.overflow-hidden { overflow: hidden } -.overflow-scroll { overflow: scroll } -.overflow-auto { overflow: auto } +.overflow-hidden{ overflow:hidden } +.overflow-scroll{ overflow:scroll } +.overflow-auto{ overflow:auto } .clearfix:before, -.clearfix:after { - content: " "; - display: table +.clearfix:after{ + content:" "; + display:table } -.clearfix:after { clear: both } +.clearfix:after{ clear:both } -.left { float: left } -.right { float: right } +.left{ float:left } +.right{ float:right } -.fit { max-width: 100% } +.fit{ max-width:100% } -.border-box { box-sizing: border-box } +.max-width-1{ max-width: 24rem } +.max-width-2{ max-width: 32rem } +.max-width-3{ max-width: 48rem } +.max-width-4{ max-width: 64rem } -.align-baseline { vertical-align: baseline } -.align-top { vertical-align: top } -.align-middle { vertical-align: middle } -.align-bottom { vertical-align: bottom } +.border-box{ box-sizing:border-box } -.m0 { margin: 0 } -.mt0 { margin-top: 0 } -.mr0 { margin-right: 0 } -.mb0 { margin-bottom: 0 } -.ml0 { margin-left: 0 } +.align-baseline{ vertical-align:baseline } +.align-top{ vertical-align:top } +.align-middle{ vertical-align:middle } +.align-bottom{ vertical-align:bottom } -.m1 { margin: .5rem } -.mt1 { margin-top: .5rem } -.mr1 { margin-right: .5rem } -.mb1 { margin-bottom: .5rem } -.ml1 { margin-left: .5rem } +.m0{ margin:0 } +.mt0{ margin-top:0 } +.mr0{ margin-right:0 } +.mb0{ margin-bottom:0 } +.ml0{ margin-left:0 } +.mx0{ margin-left:0; margin-right:0 } +.my0{ margin-top:0; margin-bottom:0 } -.m2 { margin: 1rem } -.mt2 { margin-top: 1rem } -.mr2 { margin-right: 1rem } -.mb2 { margin-bottom: 1rem } -.ml2 { margin-left: 1rem } +.m1{ margin: .5rem } +.mt1{ margin-top: .5rem } +.mr1{ margin-right: .5rem } +.mb1{ margin-bottom: .5rem } +.ml1{ margin-left: .5rem } +.mx1{ margin-left: .5rem; margin-right: .5rem } +.my1{ margin-top: .5rem; margin-bottom: .5rem } -.m3 { margin: 2rem } -.mt3 { margin-top: 2rem } -.mr3 { margin-right: 2rem } -.mb3 { margin-bottom: 2rem } -.ml3 { margin-left: 2rem } +.m2{ margin: 1rem } +.mt2{ margin-top: 1rem } +.mr2{ margin-right: 1rem } +.mb2{ margin-bottom: 1rem } +.ml2{ margin-left: 1rem } +.mx2{ margin-left: 1rem; margin-right: 1rem } +.my2{ margin-top: 1rem; margin-bottom: 1rem } -.m4 { margin: 4rem } -.mt4 { margin-top: 4rem } -.mr4 { margin-right: 4rem } -.mb4 { margin-bottom: 4rem } -.ml4 { margin-left: 4rem } +.m3{ margin: 2rem } +.mt3{ margin-top: 2rem } +.mr3{ margin-right: 2rem } +.mb3{ margin-bottom: 2rem } +.ml3{ margin-left: 2rem } +.mx3{ margin-left: 2rem; margin-right: 2rem } +.my3{ margin-top: 2rem; margin-bottom: 2rem } -.mxn1 { margin-left: -.5rem; margin-right: -.5rem; } -.mxn2 { margin-left: -1rem; margin-right: -1rem; } -.mxn3 { margin-left: -2rem; margin-right: -2rem; } -.mxn4 { margin-left: -4rem; margin-right: -4rem; } +.m4{ margin: 4rem } +.mt4{ margin-top: 4rem } +.mr4{ margin-right: 4rem } +.mb4{ margin-bottom: 4rem } +.ml4{ margin-left: 4rem } +.mx4{ margin-left: 4rem; margin-right: 4rem } +.my4{ margin-top: 4rem; margin-bottom: 4rem } -.mx-auto { margin-left: auto; margin-right: auto; } -.p0 { padding: 0 } +.mxn1{ margin-left: -.5rem; margin-right: -.5rem; } +.mxn2{ margin-left: -1rem; margin-right: -1rem; } +.mxn3{ margin-left: -2rem; margin-right: -2rem; } +.mxn4{ margin-left: -4rem; margin-right: -4rem; } -.p1 { padding: .5rem } -.py1 { padding-top: .5rem; padding-bottom: .5rem } -.px1 { padding-left: .5rem; padding-right: .5rem } +.ml-auto{ margin-left:auto } +.mr-auto{ margin-right:auto } +.mx-auto{ margin-left:auto; margin-right:auto; } -.p2 { padding: 1rem } -.py2 { padding-top: 1rem; padding-bottom: 1rem } -.px2 { padding-left: 1rem; padding-right: 1rem } +.p0{ padding:0 } +.pt0{ padding-top:0 } +.pr0{ padding-right:0 } +.pb0{ padding-bottom:0 } +.pl0{ padding-left:0 } +.px0{ padding-left:0; padding-right:0 } +.py0{ padding-top:0; padding-bottom:0 } -.p3 { padding: 2rem } -.py3 { padding-top: 2rem; padding-bottom: 2rem } -.px3 { padding-left: 2rem; padding-right: 2rem } +.p1{ padding: .5rem } +.pt1{ padding-top: .5rem } +.pr1{ padding-right: .5rem } +.pb1{ padding-bottom: .5rem } +.pl1{ padding-left: .5rem } +.py1{ padding-top: .5rem; padding-bottom: .5rem } +.px1{ padding-left: .5rem; padding-right: .5rem } -.p4 { padding: 4rem } -.py4 { padding-top: 4rem; padding-bottom: 4rem } -.px4 { padding-left: 4rem; padding-right: 4rem } +.p2{ padding: 1rem } +.pt2{ padding-top: 1rem } +.pr2{ padding-right: 1rem } +.pb2{ padding-bottom: 1rem } +.pl2{ padding-left: 1rem } +.py2{ padding-top: 1rem; padding-bottom: 1rem } +.px2{ padding-left: 1rem; padding-right: 1rem } -.relative { position: relative } -.absolute { position: absolute } -.fixed { position: fixed } +.p3{ padding: 2rem } +.pt3{ padding-top: 2rem } +.pr3{ padding-right: 2rem } +.pb3{ padding-bottom: 2rem } +.pl3{ padding-left: 2rem } +.py3{ padding-top: 2rem; padding-bottom: 2rem } +.px3{ padding-left: 2rem; padding-right: 2rem } -.top-0 { top: 0 } -.right-0 { right: 0 } -.bottom-0 { bottom: 0 } -.left-0 { left: 0 } +.p4{ padding: 4rem } +.pt4{ padding-top: 4rem } +.pr4{ padding-right: 4rem } +.pb4{ padding-bottom: 4rem } +.pl4{ padding-left: 4rem } +.py4{ padding-top: 4rem; padding-bottom: 4rem } +.px4{ padding-left: 4rem; padding-right: 4rem } -.z1 { z-index: 1 } -.z2 { z-index: 2 } -.z3 { z-index: 3 } -.z4 { z-index: 4 } - -.sm-show, .md-show, .lg-show { - display: none !important +.col{ + float:left; + box-sizing:border-box; } -@media (min-width: 40em) { - .sm-show { display: block !important } +.col-right{ + float:right; + box-sizing:border-box; } -@media (min-width: 52em) { - .md-show { display: block !important } +.col-1{ + width:8.33333%; } -@media (min-width: 64em) { - .lg-show { display: block !important } +.col-2{ + width:16.66667%; } - -@media (min-width: 40em) { - .sm-hide { display: none !important } +.col-3{ + width:25%; } -@media (min-width: 52em) { - .md-hide { display: none !important } +.col-4{ + width:33.33333%; } -@media (min-width: 64em) { - .lg-hide { display: none !important } +.col-5{ + width:41.66667%; } -.display-none { display: none !important } - -.hide { - position: absolute !important; - height: 1px; - width: 1px; - overflow: hidden; - clip: rect(1px, 1px, 1px, 1px); +.col-6{ + width:50%; } -.container { - max-width: 64em; - margin-left: auto; - margin-right: auto; -} -.col { - float: left; - box-sizing: border-box; +.col-7{ + width:58.33333%; } -.col-right { - float: right; - box-sizing: border-box; +.col-8{ + width:66.66667%; } -.col-1 { - width: 8.33333%; +.col-9{ + width:75%; } -.col-2 { - width: 16.66667%; +.col-10{ + width:83.33333%; } -.col-3 { - width: 25%; +.col-11{ + width:91.66667%; } -.col-4 { - width: 33.33333%; +.col-12{ + width:100%; } +@media (min-width: 40em){ -.col-5 { - width: 41.66667%; -} - -.col-6 { - width: 50%; -} - -.col-7 { - width: 58.33333%; -} - -.col-8 { - width: 66.66667%; -} - -.col-9 { - width: 75%; -} - -.col-10 { - width: 83.33333%; -} - -.col-11 { - width: 91.66667%; -} - -.col-12 { - width: 100%; -} -@media (min-width: 40em) { - - .sm-col { - float: left; - box-sizing: border-box; + .sm-col{ + float:left; + box-sizing:border-box; } - .sm-col-right { - float: right; - box-sizing: border-box; + .sm-col-right{ + float:right; + box-sizing:border-box; } - .sm-col-1 { - width: 8.33333%; + .sm-col-1{ + width:8.33333%; } - .sm-col-2 { - width: 16.66667%; + .sm-col-2{ + width:16.66667%; } - .sm-col-3 { - width: 25%; + .sm-col-3{ + width:25%; } - .sm-col-4 { - width: 33.33333%; + .sm-col-4{ + width:33.33333%; } - .sm-col-5 { - width: 41.66667%; + .sm-col-5{ + width:41.66667%; } - .sm-col-6 { - width: 50%; + .sm-col-6{ + width:50%; } - .sm-col-7 { - width: 58.33333%; + .sm-col-7{ + width:58.33333%; } - .sm-col-8 { - width: 66.66667%; + .sm-col-8{ + width:66.66667%; } - .sm-col-9 { - width: 75%; + .sm-col-9{ + width:75%; } - .sm-col-10 { - width: 83.33333%; + .sm-col-10{ + width:83.33333%; } - .sm-col-11 { - width: 91.66667%; + .sm-col-11{ + width:91.66667%; } - .sm-col-12 { - width: 100%; + .sm-col-12{ + width:100%; } } -@media (min-width: 52em) { +@media (min-width: 52em){ - .md-col { - float: left; - box-sizing: border-box; + .md-col{ + float:left; + box-sizing:border-box; } - .md-col-right { - float: right; - box-sizing: border-box; + .md-col-right{ + float:right; + box-sizing:border-box; } - .md-col-1 { - width: 8.33333%; + .md-col-1{ + width:8.33333%; } - .md-col-2 { - width: 16.66667%; + .md-col-2{ + width:16.66667%; } - .md-col-3 { - width: 25%; + .md-col-3{ + width:25%; } - .md-col-4 { - width: 33.33333%; + .md-col-4{ + width:33.33333%; } - .md-col-5 { - width: 41.66667%; + .md-col-5{ + width:41.66667%; } - .md-col-6 { - width: 50%; + .md-col-6{ + width:50%; } - .md-col-7 { - width: 58.33333%; + .md-col-7{ + width:58.33333%; } - .md-col-8 { - width: 66.66667%; + .md-col-8{ + width:66.66667%; } - .md-col-9 { - width: 75%; + .md-col-9{ + width:75%; } - .md-col-10 { - width: 83.33333%; + .md-col-10{ + width:83.33333%; } - .md-col-11 { - width: 91.66667%; + .md-col-11{ + width:91.66667%; } - .md-col-12 { - width: 100%; + .md-col-12{ + width:100%; } } -@media (min-width: 64em) { +@media (min-width: 64em){ - .lg-col { - float: left; - box-sizing: border-box; + .lg-col{ + float:left; + box-sizing:border-box; } - .lg-col-right { - float: right; - box-sizing: border-box; + .lg-col-right{ + float:right; + box-sizing:border-box; } - .lg-col-1 { - width: 8.33333%; + .lg-col-1{ + width:8.33333%; } - .lg-col-2 { - width: 16.66667%; + .lg-col-2{ + width:16.66667%; } - .lg-col-3 { - width: 25%; + .lg-col-3{ + width:25%; } - .lg-col-4 { - width: 33.33333%; + .lg-col-4{ + width:33.33333%; } - .lg-col-5 { - width: 41.66667%; + .lg-col-5{ + width:41.66667%; } - .lg-col-6 { - width: 50%; + .lg-col-6{ + width:50%; } - .lg-col-7 { - width: 58.33333%; + .lg-col-7{ + width:58.33333%; } - .lg-col-8 { - width: 66.66667%; + .lg-col-8{ + width:66.66667%; } - .lg-col-9 { - width: 75%; + .lg-col-9{ + width:75%; } - .lg-col-10 { - width: 83.33333%; + .lg-col-10{ + width:83.33333%; } - .lg-col-11 { - width: 91.66667%; + .lg-col-11{ + width:91.66667%; } - .lg-col-12 { - width: 100%; + .lg-col-12{ + width:100%; } } +.flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } -.flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } - -.flex-column { -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column } -.flex-wrap { -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap } - -.flex-center { -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center } -.flex-baseline { -webkit-box-align: baseline; -webkit-align-items: baseline; -ms-flex-align: baseline; align-items: baseline } -.flex-stretch { -webkit-box-align: stretch; -webkit-align-items: stretch; -ms-flex-align: stretch; align-items: stretch } -.flex-start { -webkit-box-align: start; -webkit-align-items: flex-start; -ms-flex-align: start; align-items: flex-start } -.flex-end { -webkit-box-align: end; -webkit-align-items: flex-end; -ms-flex-align: end; align-items: flex-end } - -.flex-justify { -webkit-box-pack: justify; -webkit-justify-content: space-between; -ms-flex-pack: justify; justify-content: space-between } - -.flex-auto { - -webkit-box-flex: 1; - -webkit-flex: 1 1 auto; - -ms-flex: 1 1 auto; - flex: 1 1 auto; - min-width: 0; - min-height: 0; -} -.flex-grow { -webkit-box-flex: 1; -webkit-flex: 1 0 auto; -ms-flex: 1 0 auto; flex: 1 0 auto } -.flex-none { -webkit-box-flex: 0; -webkit-flex: none; -ms-flex: none; flex: none } - -.flex-first { -webkit-box-ordinal-group: 0; -webkit-order: -1; -ms-flex-order: -1; order: -1 } -.flex-last { -webkit-box-ordinal-group: 100000; -webkit-order: 99999; -ms-flex-order: 99999; order: 99999 } -@media (min-width: 40em) { - .sm-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } -} -@media (min-width: 52em) { - .md-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } -} -@media (min-width: 64em) { - .lg-flex { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex } +@media (min-width: 40em){ + .sm-flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } } -.border { - border-style: solid; +@media (min-width: 52em){ + .md-flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } +} + +@media (min-width: 64em){ + .lg-flex{ display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex } +} + +.flex-column{ -webkit-box-orient:vertical; -webkit-box-direction:normal; -webkit-flex-direction:column; -ms-flex-direction:column; flex-direction:column } +.flex-wrap{ -webkit-flex-wrap:wrap; -ms-flex-wrap:wrap; flex-wrap:wrap } + +.items-start{ -webkit-box-align:start; -webkit-align-items:flex-start; -ms-flex-align:start; -ms-grid-row-align:flex-start; align-items:flex-start } +.items-end{ -webkit-box-align:end; -webkit-align-items:flex-end; -ms-flex-align:end; -ms-grid-row-align:flex-end; align-items:flex-end } +.items-center{ -webkit-box-align:center; -webkit-align-items:center; -ms-flex-align:center; -ms-grid-row-align:center; align-items:center } +.items-baseline{ -webkit-box-align:baseline; -webkit-align-items:baseline; -ms-flex-align:baseline; -ms-grid-row-align:baseline; align-items:baseline } +.items-stretch{ -webkit-box-align:stretch; -webkit-align-items:stretch; -ms-flex-align:stretch; -ms-grid-row-align:stretch; align-items:stretch } + +.self-start{ -webkit-align-self:flex-start; -ms-flex-item-align:start; align-self:flex-start } +.self-end{ -webkit-align-self:flex-end; -ms-flex-item-align:end; align-self:flex-end } +.self-center{ -webkit-align-self:center; -ms-flex-item-align:center; align-self:center } +.self-baseline{ -webkit-align-self:baseline; -ms-flex-item-align:baseline; align-self:baseline } +.self-stretch{ -webkit-align-self:stretch; -ms-flex-item-align:stretch; align-self:stretch } + +.justify-start{ -webkit-box-pack:start; -webkit-justify-content:flex-start; -ms-flex-pack:start; justify-content:flex-start } +.justify-end{ -webkit-box-pack:end; -webkit-justify-content:flex-end; -ms-flex-pack:end; justify-content:flex-end } +.justify-center{ -webkit-box-pack:center; -webkit-justify-content:center; -ms-flex-pack:center; justify-content:center } +.justify-between{ -webkit-box-pack:justify; -webkit-justify-content:space-between; -ms-flex-pack:justify; justify-content:space-between } +.justify-around{ -webkit-justify-content:space-around; -ms-flex-pack:distribute; justify-content:space-around } + +.content-start{ -webkit-align-content:flex-start; -ms-flex-line-pack:start; align-content:flex-start } +.content-end{ -webkit-align-content:flex-end; -ms-flex-line-pack:end; align-content:flex-end } +.content-center{ -webkit-align-content:center; -ms-flex-line-pack:center; align-content:center } +.content-between{ -webkit-align-content:space-between; -ms-flex-line-pack:justify; align-content:space-between } +.content-around{ -webkit-align-content:space-around; -ms-flex-line-pack:distribute; align-content:space-around } +.content-stretch{ -webkit-align-content:stretch; -ms-flex-line-pack:stretch; align-content:stretch } +.flex-auto{ + -webkit-box-flex:1; + -webkit-flex:1 1 auto; + -ms-flex:1 1 auto; + flex:1 1 auto; + min-width:0; + min-height:0; +} +.flex-none{ -webkit-box-flex:0; -webkit-flex:none; -ms-flex:none; flex:none } + +.order-0{ -webkit-box-ordinal-group:1; -webkit-order:0; -ms-flex-order:0; order:0 } +.order-1{ -webkit-box-ordinal-group:2; -webkit-order:1; -ms-flex-order:1; order:1 } +.order-2{ -webkit-box-ordinal-group:3; -webkit-order:2; -ms-flex-order:2; order:2 } +.order-3{ -webkit-box-ordinal-group:4; -webkit-order:3; -ms-flex-order:3; order:3 } +.order-last{ -webkit-box-ordinal-group:100000; -webkit-order:99999; -ms-flex-order:99999; order:99999 } + +.relative{ position:relative } +.absolute{ position:absolute } +.fixed{ position:fixed } + +.top-0{ top:0 } +.right-0{ right:0 } +.bottom-0{ bottom:0 } +.left-0{ left:0 } + +.z1{ z-index: 1 } +.z2{ z-index: 2 } +.z3{ z-index: 3 } +.z4{ z-index: 4 } + +.border{ + border-style:solid; border-width: 1px; - border-color: rgba(0,0,0,.125); } -.border-top { - border-top-style: solid; +.border-top{ + border-top-style:solid; border-top-width: 1px; - border-top-color: rgba(0,0,0,.125); } -.border-right { - border-right-style: solid; +.border-right{ + border-right-style:solid; border-right-width: 1px; - border-right-color: rgba(0,0,0,.125); } -.border-bottom { - border-bottom-style: solid; +.border-bottom{ + border-bottom-style:solid; border-bottom-width: 1px; - border-bottom-color: rgba(0,0,0,.125); } -.border-left { - border-left-style: solid; +.border-left{ + border-left-style:solid; border-left-width: 1px; - border-left-color: rgba(0,0,0,.125); } -.border-none { border: 0 } +.border-none{ border:0 } -.rounded { border-radius: 3px } -.circle { border-radius: 50% } +.rounded{ border-radius: 3px } +.circle{ border-radius:50% } -.rounded-top { border-radius: 3px 3px 0 0 } -.rounded-right { border-radius: 0 3px 3px 0 } -.rounded-bottom { border-radius: 0 0 3px 3px } -.rounded-left { border-radius: 3px 0 0 3px } +.rounded-top{ border-radius: 3px 3px 0 0 } +.rounded-right{ border-radius: 0 3px 3px 0 } +.rounded-bottom{ border-radius: 0 0 3px 3px } +.rounded-left{ border-radius: 3px 0 0 3px } -.not-rounded { border-radius: 0 } +.not-rounded{ border-radius:0 } -.black { color: #111 } -.gray { color: #aaa } -.silver { color: #ddd } -.white { color: #fff } +.hide{ + position:absolute !important; + height:1px; + width:1px; + overflow:hidden; + clip:rect(1px, 1px, 1px, 1px); +} -.aqua { color: #7fdbff } -.blue { color: #0074d9 } -.navy { color: #001f3f } -.teal { color: #39cccc } -.green { color: #2ecc40 } -.olive { color: #3d9970 } -.lime { color: #01ff70 } +@media (max-width: 40em){ + .xs-hide{ display:none !important } +} -.yellow { color: #ffdc00 } -.orange { color: #ff851b } -.red { color: #ff4136 } -.fuchsia { color: #f012be } -.purple { color: #b10dc9 } -.maroon { color: #85144b } +@media (min-width: 40em) and (max-width: 52em){ + .sm-hide{ display:none !important } +} -.color-inherit { color: inherit } -.muted { opacity: .5 } +@media (min-width: 52em) and (max-width: 64em){ + .md-hide{ display:none !important } +} -.bg-black { background-color: #111 } -.bg-gray { background-color: #aaa } -.bg-silver { background-color: #ddd } -.bg-white { background-color: #fff } - -.bg-aqua { background-color: #7fdbff } -.bg-blue { background-color: #0074d9 } -.bg-navy { background-color: #001f3f } -.bg-teal { background-color: #39cccc } -.bg-green { background-color: #2ecc40 } -.bg-olive { background-color: #3d9970 } -.bg-lime { background-color: #01ff70 } - -.bg-yellow { background-color: #ffdc00 } -.bg-orange { background-color: #ff851b } -.bg-red { background-color: #ff4136 } -.bg-fuchsia { background-color: #f012be } -.bg-purple { background-color: #b10dc9 } -.bg-maroon { background-color: #85144b } - -.bg-darken-1 { background-color: rgba(0,0,0,.0625) } -.bg-darken-2 { background-color: rgba(0,0,0,.125) } -.bg-darken-3 { background-color: rgba(0,0,0,.25) } -.bg-darken-4 { background-color: rgba(0,0,0,.5) } - -.bg-lighten-1 { background-color: rgba(255,255,255,.0625) } -.bg-lighten-2 { background-color: rgba(255,255,255,.125) } -.bg-lighten-3 { background-color: rgba(255,255,255,.25) } -.bg-lighten-4 { background-color: rgba(255,255,255,.5) } +@media (min-width: 64em){ + .lg-hide{ display:none !important } +} +.display-none{ display:none !important } diff --git a/docs/assets/fonts/EOT/SourceCodePro-Bold.eot b/docs/assets/fonts/EOT/SourceCodePro-Bold.eot new file mode 100755 index 0000000..d24cc39 Binary files /dev/null and b/docs/assets/fonts/EOT/SourceCodePro-Bold.eot differ diff --git a/docs/assets/fonts/EOT/SourceCodePro-Regular.eot b/docs/assets/fonts/EOT/SourceCodePro-Regular.eot new file mode 100755 index 0000000..09e9473 Binary files /dev/null and b/docs/assets/fonts/EOT/SourceCodePro-Regular.eot differ diff --git a/docs/assets/fonts/LICENSE.txt b/docs/assets/fonts/LICENSE.txt new file mode 100755 index 0000000..d154618 --- /dev/null +++ b/docs/assets/fonts/LICENSE.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/docs/assets/fonts/OTF/SourceCodePro-Bold.otf b/docs/assets/fonts/OTF/SourceCodePro-Bold.otf new file mode 100755 index 0000000..f4e576c Binary files /dev/null and b/docs/assets/fonts/OTF/SourceCodePro-Bold.otf differ diff --git a/docs/assets/fonts/OTF/SourceCodePro-Regular.otf b/docs/assets/fonts/OTF/SourceCodePro-Regular.otf new file mode 100755 index 0000000..4e3b9d0 Binary files /dev/null and b/docs/assets/fonts/OTF/SourceCodePro-Regular.otf differ diff --git a/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf b/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf new file mode 100755 index 0000000..e0c576f Binary files /dev/null and b/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf differ diff --git a/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf b/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf new file mode 100755 index 0000000..437f472 Binary files /dev/null and b/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf differ diff --git a/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff b/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff new file mode 100755 index 0000000..cf96099 Binary files /dev/null and b/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff differ diff --git a/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff b/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff new file mode 100755 index 0000000..395436e Binary files /dev/null and b/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff differ diff --git a/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff b/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff new file mode 100755 index 0000000..c65ba84 Binary files /dev/null and b/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff differ diff --git a/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff b/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff new file mode 100755 index 0000000..0af792a Binary files /dev/null and b/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff differ diff --git a/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 b/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 new file mode 100755 index 0000000..cbe3835 Binary files /dev/null and b/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 differ diff --git a/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 b/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 new file mode 100755 index 0000000..65cd591 Binary files /dev/null and b/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 differ diff --git a/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 b/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 new file mode 100755 index 0000000..b78d523 Binary files /dev/null and b/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 differ diff --git a/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 b/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 new file mode 100755 index 0000000..18d2199 Binary files /dev/null and b/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 differ diff --git a/docs/assets/fonts/source-code-pro.css b/docs/assets/fonts/source-code-pro.css new file mode 100755 index 0000000..3abb4f0 --- /dev/null +++ b/docs/assets/fonts/source-code-pro.css @@ -0,0 +1,23 @@ +@font-face{ + font-family: 'Source Code Pro'; + font-weight: 400; + font-style: normal; + font-stretch: normal; + src: url('EOT/SourceCodePro-Regular.eot') format('embedded-opentype'), + url('WOFF2/TTF/SourceCodePro-Regular.ttf.woff2') format('woff2'), + url('WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'), + url('OTF/SourceCodePro-Regular.otf') format('opentype'), + url('TTF/SourceCodePro-Regular.ttf') format('truetype'); +} + +@font-face{ + font-family: 'Source Code Pro'; + font-weight: 700; + font-style: normal; + font-stretch: normal; + src: url('EOT/SourceCodePro-Bold.eot') format('embedded-opentype'), + url('WOFF2/TTF/SourceCodePro-Bold.ttf.woff2') format('woff2'), + url('WOFF/OTF/SourceCodePro-Bold.otf.woff') format('woff'), + url('OTF/SourceCodePro-Bold.otf') format('opentype'), + url('TTF/SourceCodePro-Bold.ttf') format('truetype'); +} diff --git a/docs/assets/site.js b/docs/assets/site.js index 2cb0fb3..559c65e 100644 --- a/docs/assets/site.js +++ b/docs/assets/site.js @@ -2,39 +2,107 @@ // add anchor links to headers anchors.options.placement = 'left'; -anchors.add().remove('.no-anchor'); +anchors.add('h3'); // Filter UI -var tocElements = document.getElementById('toc').getElementsByTagName('a'); -document.getElementById('filter-input').addEventListener('keyup', function(e) { +var tocElements = document.getElementById('toc') + .getElementsByTagName('li'); - var i, element; +document.getElementById('filter-input') + .addEventListener('keyup', function (e) { - // enter key - if (e.keyCode === 13) { - // go to the first displayed item in the toc - for (i = 0; i < tocElements.length; i++) { - element = tocElements[i]; - if (!element.classList.contains('hide')) { - location.replace(element.href); - return e.preventDefault(); + var i, element, children; + + // enter key + if (e.keyCode === 13) { + // go to the first displayed item in the toc + for (i = 0; i < tocElements.length; i++) { + element = tocElements[i]; + if (!element.classList.contains('display-none')) { + location.replace(element.firstChild.href); + return e.preventDefault(); + } } } - } - var match = function() { return true; }, - value = this.value.toLowerCase(); + var match = function () { + return true; + }; - if (!value.match(/^\s*$/)) { - match = function(text) { return text.toLowerCase().indexOf(value) !== -1; }; - } + var value = this.value.toLowerCase(); - for (i = 0; i < tocElements.length; i++) { - element = tocElements[i]; - if (match(element.innerHTML)) { - element.classList.remove('hide'); - } else { - element.classList.add('hide'); + if (!value.match(/^\s*$/)) { + match = function (element) { + return element.firstChild.innerHTML.toLowerCase().indexOf(value) !== -1; + }; } + + for (i = 0; i < tocElements.length; i++) { + element = tocElements[i]; + children = Array.from(element.getElementsByTagName('li')); + if (match(element) || children.some(match)) { + element.classList.remove('display-none'); + } else { + element.classList.add('display-none'); + } + } + }); + +var toggles = document.getElementsByClassName('toggle-step-sibling'); +for (var i = 0; i < toggles.length; i++) { + toggles[i].addEventListener('click', toggleStepSibling); +} + +function toggleStepSibling() { + var stepSibling = this.parentNode.parentNode.parentNode.getElementsByClassName('toggle-target')[0]; + var klass = 'display-none'; + if (stepSibling.classList.contains(klass)) { + stepSibling.classList.remove(klass); + stepSibling.innerHTML = '▾'; + } else { + stepSibling.classList.add(klass); + stepSibling.innerHTML = '▸'; } +} + +var items = document.getElementsByClassName('toggle-sibling'); +for (var j = 0; j < items.length; j++) { + items[j].addEventListener('click', toggleSibling); +} + +function toggleSibling() { + var stepSibling = this.parentNode.getElementsByClassName('toggle-target')[0]; + var icon = this.getElementsByClassName('icon')[0]; + var klass = 'display-none'; + if (stepSibling.classList.contains(klass)) { + stepSibling.classList.remove(klass); + icon.innerHTML = '▾'; + } else { + stepSibling.classList.add(klass); + icon.innerHTML = '▸'; + } +} + +function showHashTarget(targetId) { + var hashTarget = document.getElementById(targetId); + // new target is hidden + if (hashTarget && hashTarget.offsetHeight === 0 && + hashTarget.parentNode.parentNode.classList.contains('display-none')) { + hashTarget.parentNode.parentNode.classList.remove('display-none'); + } +} + +window.addEventListener('hashchange', function() { + showHashTarget(location.hash.substring(1)); }); + +showHashTarget(location.hash.substring(1)); + +var toclinks = document.getElementsByClassName('pre-open'); +for (var k = 0; k < toclinks.length; k++) { + toclinks[k].addEventListener('mousedown', preOpen, false); +} + +function preOpen() { + showHashTarget(this.hash.substring(1)); +} diff --git a/docs/assets/style.css b/docs/assets/style.css index d32c748..d7e56e0 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -1,68 +1,55 @@ -.documentation a { +.documentation { + font-family: Helvetica, sans-serif; + color: #666; + line-height: 1.5; + background: #f5f5f5; +} + +.black { + color: #666; +} + +.bg-white { + background-color: #fff; +} + +h4 { + margin: 20px 0 10px 0; +} + +.documentation h3 { + color: #000; +} + +.border-bottom { + border-color: #ddd; +} + +a { color: #1184CE; + text-decoration: none; } -.documentation .suppress-p-margin p { - margin:0; +.documentation a[href]:hover { + text-decoration: underline; } -.force-inline, .force-inline p { - display: inline; - color: #222; +a:hover { + cursor: pointer; } -.container-small { - max-width: 58rem; - margin-left: auto; - margin-right: auto; +.py1-ul li { + padding: 5px 0; } .max-height-100 { max-height: 100%; } -.fade { - opacity:0.50; -} - -.button-indent { - padding: .25rem 1.5rem; - font-size: 90%; -} - -.section-indent { - border-left: 2px solid #eee; -} - -.bg-cloudy { - background: #fafafa; -} - -.force-inline * { - display:inline; -} - section:target h3 { font-weight:700; } -.documentation, -.documentation h1, -.documentation h2, -.documentation h3, -.documentation h4, -.documentation h5, -.documentation h6 { - font-family: 'Source Sans Pro', Helvetica, sans-serif; -} - -.documentation pre, -.documentation code, -.documentation samp { - font-family: 'Source Code Pro', monospace; - font-size: 90%; -} - .documentation td, .documentation th { padding: .25rem .25rem; @@ -75,12 +62,9 @@ h4:hover .anchorjs-link { opacity: 1; } -.collapsible .collapser { - display:none; -} - -.collapsible:target .collapser { - display: block; +.fix-3 { + width: 25%; + max-width: 244px; } .fix-3 { @@ -93,3 +77,60 @@ h4:hover .anchorjs-link { margin-left: 25%; } } + +.pre, pre, code, .code { + font-family: Source Code Pro,Menlo,Consolas,Liberation Mono,monospace; + font-size: 14px; +} + +.fill-light { + background: #F9F9F9; +} + +.width2 { + width: 1rem; +} + +.input { + font-family: inherit; + display: block; + width: 100%; + height: 2rem; + padding: .5rem; + margin-bottom: 1rem; + border: 1px solid #ccc; + font-size: .875rem; + border-radius: 3px; + box-sizing: border-box; +} + +table { + border-collapse: collapse; +} + +.prose table th, +.prose table td { + text-align: left; + padding:8px; + border:1px solid #ddd; +} + +.prose table th:nth-child(1) { border-right: none; } +.prose table th:nth-child(2) { border-left: none; } + +.prose table { + border:1px solid #ddd; +} + +.prose-big { + font-size: 18px; + line-height: 30px; +} + +.quiet { + opacity: 0.7; +} + +.minishadow { + box-shadow: 2px 2px 10px #f3f3f3; +} diff --git a/docs/index.html b/docs/index.html index 9d2aa12..d05d60e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,2174 +4,4152 @@ | Documentation - -
+
-
+

- - NodeQuery - - - #constructor + +
+
-
-
-

- NodeQuery(config) -

+ + +
+ + +
+

+ limit +

+ +
+ + +

Set the limit clause

+ + +
limit(sql: String, limit: Number, offset: [Number]): String
+ + + + + + + + + + +
Parameters
+
+ +
+
+ sql (String) SQL statement to modify + +
+ +
+ +
+
+ limit (Number) Maximum number of rows to fetch + +
+ +
+ +
+
+ offset ([Number]) Number of rows to skip + +
+ +
+ +
+ + + + + + +
Returns
+ String: + Modified SQL statement + + + + + + + + + + + + + + +
+ + + + +
+ + +
+

+ quoteTable +

+ +
+ + +

Quote database table name, and set prefix

+ + +
quoteTable(table: String): String
+ + + + + + + + + + +
Parameters
+
+ +
+
+ table (String) Table name to quote + +
+ +
+ +
+ + + + + + +
Returns
+ String: + Quoted table name + + + + + + + + + + + + + + +
+ + + + +
+ + +
+

+ quoteIdentifiers +

+ +
+ + +

Use the driver's escape character to quote identifiers

+ + +
quoteIdentifiers(str: (String | Array)): (String | Array)
+ + + + + + + + + + +
Parameters
+
+ +
+
+ str ((String | Array)) String or array of strings to quote identifiers + +
+ +
+ +
+ + + + + + +
Returns
+ (String | Array): + Quoted identifier(s) + + + + + + + + + + + + + + +
+ + + + +
+ + +
+

+ truncate +

+ +
+ + +

Generate SQL to truncate the passed table

+ + +
truncate(table: String): String
+ + + + + + + + + + +
Parameters
+
+ +
+
+ table (String) Table to truncate + +
+ +
+ +
+ + + + + + +
Returns
+ String: + Truncation SQL + + + + + + + + + + + + + + +
+ + + + +
+ + +
+

+ insertBatch +

+ +
+ + +

Generate SQL to insert a group of rows

+ + +
insertBatch(table: String, data: [Array]): String
+ + + + + + + + + + +
Parameters
+
+ +
+
+ table (String) The table to insert to + +
+ +
+ +
+
+ data ([Array]) The array of object containing data to insert + +
+ +
+ +
+ + + + + + +
Returns
+ String: + Query and data to insert + + + + + + + + + + + + + + +
+ + + + +
+ + +
+

+ NodeQuery +

+ +
+ +

Class for connection management

-

Parameters

-
    -
  • object config - : -
    -

    connection parameters

    + +
    new NodeQuery(config: object)
    + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + config (object) connection parameters
    -
  • -
-

Instance members

-
- - - #constructor(config) - -
-

Constructor

- -
-
-
-
-

- constructor(config) -

-

Constructor

- -

Parameters

-
    -
  • object config - : -
    -

    connection parameters

    - -
    -
  • -
-

Examples

-
let nodeQuery = require('ci-node-query')({
-            	driver: 'mysql',
-            	connection: {
-            		host: 'localhost',
-            		user: 'root',
-            		password: '',
-            		database: 'mysql'
-            	}
-            });
let nodeQuery = require('ci-node-query')({
-            	driver: 'sqlite',
-            	connection: ':memory:'
-            });
-
-
+
- - -
-
-

- getQuery -

-

Return an existing query builder instance

- -

Returns

- QueryBuilder - : -
-

The Query Builder object

- -
-
-
+ + + + + + + + + + + +
Instance Members
+
+ +
+
+
+ + constructor(config)
+
+
-

- QueryBuilder(Driver, Adapter) -

+ +
+
+ +
+
+
+ + getQuery() +
+
+ +
+ +
+ + + + +
+ + + + +
+ + +
+

+ QueryBuilder +

+ +
+ +

Main object that builds SQL queries.

-

Parameters

-
    -
  • Driver Driver - : -
    -

    The syntax driver for the database

    + +
    new QueryBuilder(Driver: Driver, Adapter: Adapter)
    + + +

    + Extends + + QueryBuilderBase + +

    + + + + + + + + + +
    Parameters
    +
    + +
    +
    + Driver (Driver) The syntax driver for the database
    -
  • -
  • Adapter Adapter - : -
    -

    The database module adapter for running queries

    - -
    -
  • -
-

Instance members

-
- - - #delete(table, [where], [callback]) - -
-

Run the generated delete query

- -
-
-
-
-

- delete(table, [where], [callback]) -

-

Run the generated delete query

- -

Parameters

-
    -
  • String table - : -
    -

    The table to insert into

    - -
    -
  • -
  • [Object] where - : -
    -

    Where clause for delete statement

    - -
    -
  • -
  • [Function] callback - : -
    -

    Callback for handling response from the database

    - -
    -
  • -
-

Returns

- void or Promise - : -
-

If no callback is passed, a promise is returned

- -
-
-
+
-
- - - #end - -
-

Closes the database connection for the current adapter

+ +
+
+ Adapter (Adapter) The database module adapter for running queries -
-
-
-
-

- end -

-

Closes the database connection for the current adapter

- -

Returns

- void - -
- -
-
+
- - -
-
-

- from(tableName) -

-

Specify the database table to select from

- -

Parameters

-
    -
  • String tableName - : -
    -

    The table to use for the current query

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-

Examples

-
query.from('tableName');
query.from('tableName t'); // Select the table with an alias
-
-
-
-
- - - #get([table], [limit], [offset], [callback]) - -
-

Get the results of the compiled query

+ -
-
-
-
-

- get([table], [limit], [offset], [callback]) -

-

Get the results of the compiled query

- -

Parameters

-
    -
  • [String] table - : -
    -

    The table to select from

    - -
    -
  • -
  • [Number] limit - : -
    -

    A limit for the query

    - -
    -
  • -
  • [Number] offset - : -
    -

    An offset for the query

    - -
    -
  • -
  • [Function] callback - : -
    -

    A callback for receiving the result

    - -
    -
  • -
-

Returns

- void or Promise - : -
-

If no callback is passed, a promise is returned

- -
-

Examples

-
query.get('table_name').then(promiseCallback); // Get all the rows in the table
query.get('table_name', 5, callback); // Get 5 rows from the table
query.get(callback); // Get the results of a query generated with other methods
-
-
-
-
- - - #getCompiledDelete(table, [reset]) - -
-

Return generated delete query SQL

+ -
-
-
-
-

- getCompiledDelete(table, [reset]) -

-

Return generated delete query SQL

- -

Parameters

-
    -
  • String table - : -
    -

    the name of the table to delete from

    - -
    -
  • -
  • [Boolean] reset - (default true) - : -
    -

    Whether to reset the query builder so another query can be built

    - -
    -
  • -
-

Returns

- String - : -
-

The compiled sql statement

- -
-
-
-
-
- - - #getCompiledInsert(table, [reset]) - -
-

Return generated insert query SQL

+ -
-
-
-
-

- getCompiledInsert(table, [reset]) -

-

Return generated insert query SQL

- -

Parameters

-
    -
  • String table - : -
    -

    the name of the table to insert into

    - -
    -
  • -
  • [Boolean] reset - (default true) - : -
    -

    Whether to reset the query builder so another query can be built

    - -
    -
  • -
-

Returns

- String - : -
-

The compiled sql statement

- -
-
-
-
-
- - - #getCompiledSelect([table], [reset]) - -
-

Return generated select query SQL

+ -
-
-
-
-

- getCompiledSelect([table], [reset]) -

-

Return generated select query SQL

- -

Parameters

-
    -
  • [String] table - : -
    -

    the name of the table to retrieve from

    - -
    -
  • -
  • [Boolean] reset - (default true) - : -
    -

    Whether to reset the query builder so another query can be built

    - -
    -
  • -
-

Returns

- String - : -
-

The compiled sql statement

- -
-
-
-
-
- - - #getCompiledUpdate(table, [reset]) - -
-

Return generated update query SQL

+ -
-
-
-
-

- getCompiledUpdate(table, [reset]) -

-

Return generated update query SQL

- -

Parameters

-
    -
  • String table - : -
    -

    the name of the table to update

    - -
    -
  • -
  • [Boolean] reset - (default true) - : -
    -

    Whether to reset the query builder so another query can be built

    - -
    -
  • -
-

Returns

- String - : -
-

The compiled sql statement

- -
-
-
+ +
Instance Members
+
+ +
+
+
+ + query(sql, [params], [callback])
-
- - - #groupBy(field) - -
-

Group the results by the selected field(s)

+
+ -
-
-
-

- groupBy(field) -

-

Group the results by the selected field(s)

- -

Parameters

-
    -
  • String or Array field - : -
    -

    The name of the field to group by

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #groupEnd - -
-

Ends a logical grouping started with one of the groupStart methods

+ -
-
-
-
-

- groupEnd -

-

Ends a logical grouping started with one of the groupStart methods

- -

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #groupStart - -
-

Adds an open paren to the current query for logical grouping

+

Run an arbitrary sql query. Run as a prepared statement.

-
-
-
-
-

- groupStart -

-

Adds an open paren to the current query for logical grouping

- -

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #having(key, [val]) - -
-

Add a 'having' clause

-
-
-
-
-

- having(key, [val]) -

-

Add a 'having' clause

- -

Parameters

-
    -
  • String or Object key - : -
    -

    The name of the field and the comparision operator, or an object

    - -
    -
  • -
  • [String or Number] val - : -
    -

    The value to compare if the value of key is a string

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #insert(table, [data], [callback]) - - - -
-
-

- insert(table, [data], [callback]) -

-

Run the generated insert query

- -

Parameters

-
    -
  • String table - : -
    -

    The table to insert into

    - -
    -
  • -
  • [Object] data - : -
    -

    Data to insert, if not already added with the 'set' method

    - -
    -
  • -
  • [Function] callback - : -
    -

    Callback for handling response from the database

    - -
    -
  • -
-

Returns

- void or Promise - : -
-

If no callback is passed, a promise is returned

- -
-
-
-
-
- - - #insertBatch(table, data, [callback]) - -
-

Insert multiple sets of rows at a time

+ -
-
-
-
-

- insertBatch(table, data, [callback]) -

-

Insert multiple sets of rows at a time

- -

Parameters

-
    -
  • String table - : -
    -

    The table to insert into

    - -
    -
  • -
  • Array data - : -
    -

    The array of objects containing data rows to insert

    - -
    -
  • -
  • [Function] callback - : -
    -

    Callback for handling database response

    - -
    -
  • -
-

Returns

- void or Promise - : -
-

If no callback is passed, a promise is returned

- -
-

Examples

-
query.insertBatch('foo',[{id:1,val:'bar'},{id:2,val:'baz'}], callbackFunction);
query.insertBatch('foo',[{id:1,val:'bar'},{id:2,val:'baz'}])
-            .then(promiseCallback);
-
-
-
-
- - - #join(table, cond, [type]) - -
-

Add a join clause to the query

+ + + + + -
-
-
-
-

- join(table, cond, [type]) -

-

Add a join clause to the query

- -

Parameters

-
    -
  • String table - : -
    -

    The table you are joining

    - -
    -
  • -
  • String cond - : -
    -

    The join condition.

    - -
    -
  • -
  • [String] type - (default 'inner') - : -
    -

    The type of join, which defaults to inner

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #like(field, val, [pos]) - -
-

Add a 'like/ and like' clause to the query

+ +
Parameters
+
+ +
+
+ sql (string) The sql to execute -
- -
-
-

- like(field, val, [pos]) -

-

Add a 'like/ and like' clause to the query

- -

Parameters

-
    -
  • String field - : -
    -

    The name of the field to compare to

    - -
    -
  • -
  • String val - : -
    -

    The value to compare to

    - -
    -
  • -
  • [String] pos - (default both) - : -
    -

    The placement of the wildcard character(s): before, after, or both

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
+
-
- - - #limit(limit, [offset]) - -
-

Put a limit on the query

+ +
+
+ params ([array]) The query parameters -
- -
-
-

- limit(limit, [offset]) -

-

Put a limit on the query

- -

Parameters

-
    -
  • Number limit - : -
    -

    The maximum number of rows to fetch

    - -
    -
  • -
  • [Number] offset - : -
    -

    The row number to start from

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
+
-
- - - #notLike(field, val, [pos]) - -
-

Add a 'not like/ and not like' clause to the query

+ +
+
+ callback ([function]) Optional callback -
- -
-
-

- notLike(field, val, [pos]) -

-

Add a 'not like/ and not like' clause to the query

- -

Parameters

-
    -
  • String field - : -
    -

    The name of the field to compare to

    - -
    -
  • -
  • String val - : -
    -

    The value to compare to

    - -
    -
  • -
  • [String] pos - (default both) - : -
    -

    The placement of the wildcard character(s): before, after, or both

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
+
- - -
-
-

- orGroupStart -

-

Adds an open paren to the current query for logical grouping, - prefixed with 'OR'

- -

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orHaving(key, [val]) - -
-

Add an 'or having' clause

+ -
-
-
-
-

- orHaving(key, [val]) -

-

Add an 'or having' clause

- -

Parameters

-
    -
  • String or Object key - : -
    -

    The name of the field and the comparision operator, or an object

    - -
    -
  • -
  • [String or Number] val - : -
    -

    The value to compare if the value of key is a string

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orLike(field, val, [pos]) - -
-

Add an 'or like' clause to the query

+ + +
Returns
+ (void |
Promise): + Returns a promise if no callback is supplied -
- -
-
-

- orLike(field, val, [pos]) -

-

Add an 'or like' clause to the query

- -

Parameters

-
    -
  • String field - : -
    -

    The name of the field to compare to

    - -
    -
  • -
  • String val - : -
    -

    The value to compare to

    - -
    -
  • -
  • [String] pos - (default both) - : -
    -

    The placement of the wildcard character(s): before, after, or both

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orNotGroupStart - -
-

Adds an open paren to the current query for logical grouping, -prefixed with 'OR NOT'

+ + + -
-
-
-
-

- orNotGroupStart -

-

Adds an open paren to the current query for logical grouping, - prefixed with 'OR NOT'

- -

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orNotLike(field, val, [pos]) - -
-

Add an 'or not like' clause to the query

+ -
-
-
-
-

- orNotLike(field, val, [pos]) -

-

Add an 'or not like' clause to the query

- -

Parameters

-
    -
  • String field - : -
    -

    The name of the field to compare to

    - -
    -
  • -
  • String val - : -
    -

    The value to compare to

    - -
    -
  • -
  • [String] pos - (default both) - : -
    -

    The placement of the wildcard character(s): before, after, or both

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orWhere(key, [val]) - -
-

Set a 'or where' clause

+ -
-
-
-
-

- orWhere(key, [val]) -

-

Set a 'or where' clause

- -

Parameters

-
    -
  • String or Object key - : -
    -

    The name of the field and the comparision operator, or an object

    - -
    -
  • -
  • [String or Number] val - : -
    -

    The value to compare if the value of key is a string

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orWhereIn(key, values) - -
-

Set a 'or where in' clause

+ -
-
-
-
-

- orWhereIn(key, values) -

-

Set a 'or where in' clause

- -

Parameters

-
    -
  • String key - : -
    -

    the field to search

    - -
    -
  • -
  • Array values - : -
    -

    the array of items to search in

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orWhereIsNotNull(field) - -
-

Field is not null prefixed with 'OR'

+ -
-
-
-
-

- orWhereIsNotNull(field) -

-

Field is not null prefixed with 'OR'

- -

Parameters

-
    -
  • String field - : -
    -

    The name of the field

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orWhereIsNull(field) - -
-

Field is null prefixed with 'OR'

- -
-
-
-
-

- orWhereIsNull(field) -

-

Field is null prefixed with 'OR'

- -

Parameters

-
    -
  • String field - : -
    -

    The name of the field

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orWhereNotIn(key, values) - -
-

Set a 'or where not in' clause

- -
-
-
-
-

- orWhereNotIn(key, values) -

-

Set a 'or where not in' clause

- -

Parameters

-
    -
  • String key - : -
    -

    the field to search

    - -
    -
  • -
  • Array values - : -
    -

    the array of items to search in

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #orderBy(field, [type]) - -
-

Order the results by the selected field(s)

- -
-
-
-
-

- orderBy(field, [type]) -

-

Order the results by the selected field(s)

- -

Parameters

-
    -
  • String field - : -
    -

    The field(s) to order by

    - -
    -
  • -
  • [String] type - (default 'ASC') - : -
    -

    The order direction, ASC or DESC

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #query(sql, [params], [callback]) - -
-

Run an arbitrary sql query. Run as a prepared statement.

- -
-
-
-
-

- query(sql, [params], [callback]) -

-

Run an arbitrary sql query. Run as a prepared statement.

- -

Parameters

-
    -
  • string sql - : -
    -

    The sql to execute

    - -
    -
  • -
  • [array] params - : -
    -

    The query parameters

    - -
    -
  • -
  • [function] callback - : -
    -

    Optional callback

    - -
    -
  • -
-

Returns

- void or Promise - : -
-

Returns a promise if no callback is supplied

- -
-
-
-
-
- - - #resetQuery - -
-

Reset the object state for a new query

- -
-
-
-
-

- resetQuery -

-

Reset the object state for a new query

- -

Returns

- void - -
- -
-
-
-
-
- - - #select(fields) - -
-

Specify rows to select in the query

- -
-
-
-
-

- select(fields) -

-

Specify rows to select in the query

- -

Parameters

-
    -
  • String or Array fields - : -
    -

    The fields to select from the current table

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-

Examples

-
query.select('foo, bar'); // Select multiple fields with a string
query.select(['foo', 'bar']); // Select multiple fileds with an array
-
-
-
-
- - - #set(key, [val]) - -
-

Set values for insertion or updating

- -
-
-
-
-

- set(key, [val]) -

-

Set values for insertion or updating

- -

Parameters

-
    -
  • String or Object key - : -
    -

    The key or object to use

    - -
    -
  • -
  • [String] val - : -
    -

    The value if using a scalar key

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-

Examples

-
query.set('foo', 'bar'); // Set a key, value pair
query.set({foo:'bar'}); // Set with an object
-
-
-
-
- - - #truncate(table, [callback]) - -
-

Empties the selected database table

- -
-
-
-
-

- truncate(table, [callback]) -

-

Empties the selected database table

- -

Parameters

-
    -
  • string table - : -
    -

    the name of the table to truncate

    - -
    -
  • -
  • [function] callback - : -
    -

    Optional callback

    - -
    -
  • -
-

Returns

- void or Promise - : -
-

Returns a promise if no callback is supplied

- -
-
-
-
-
- - - #update(table, [data], [callback]) - -
-

Run the generated update query

- -
-
-
-
-

- update(table, [data], [callback]) -

-

Run the generated update query

- -

Parameters

-
    -
  • String table - : -
    -

    The table to insert into

    - -
    -
  • -
  • [Object] data - : -
    -

    Data to insert, if not already added with the 'set' method

    - -
    -
  • -
  • [Function] callback - : -
    -

    Callback for handling response from the database

    - -
    -
  • -
-

Returns

- void or Promise - : -
-

If no callback is passed, a promise is returned

- -
-
-
-
-
- - - #where(key, [val]) - -
-

Set a 'where' clause

- -
-
-
-
-

- where(key, [val]) -

-

Set a 'where' clause

- -

Parameters

-
    -
  • String or Object key - : -
    -

    The name of the field and the comparision operator, or an object

    - -
    -
  • -
  • [String or Number] val - : -
    -

    The value to compare if the value of key is a string

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #whereIn(key, values) - -
-

Set a 'where in' clause

- -
-
-
-
-

- whereIn(key, values) -

-

Set a 'where in' clause

- -

Parameters

-
    -
  • String key - : -
    -

    the field to search

    - -
    -
  • -
  • Array values - : -
    -

    the array of items to search in

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #whereIsNotNull(field) - -
-

Specify that a field IS NOT NULL

- -
-
-
-
-

- whereIsNotNull(field) -

-

Specify that a field IS NOT NULL

- -

Parameters

-
    -
  • String field - : -
    -

    The name so the field that is not to be null

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #whereIsNull(field) - -
-

Select a field that is Null

- -
-
-
-
-

- whereIsNull(field) -

-

Select a field that is Null

- -

Parameters

-
    -
  • String field - : -
    -

    The name of the field that has a NULL value

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
-
- - - #whereNotIn(key, values) - -
-

Set a 'where not in' clause

- -
-
-
-
-

- whereNotIn(key, values) -

-

Set a 'where not in' clause

- -

Parameters

-
    -
  • String key - : -
    -

    the field to search

    - -
    -
  • -
  • Array values - : -
    -

    the array of items to search in

    - -
    -
  • -
-

Returns

- QueryBuilder - : -
-

The Query Builder object, for chaining

- -
-
-
-
+
-
-

- Result(rows, columns) -

+ +
+
+ +
+
+
+ + resetQuery() +
+
+ +
+ +
+
+
+ + truncate(table, [callback]) +
+
+ +
+ +
+
+
+ + end() +
+
+ +
+ +
+
+
+ + select(fields) +
+
+ +
+ +
+
+
+ + from(tableName) +
+
+ +
+ +
+
+
+ + like(field, val, [pos]) +
+
+ +
+ +
+
+
+ + notLike(field, val, [pos]) +
+
+ +
+ +
+
+
+ + orLike(field, val, [pos]) +
+
+ +
+ +
+
+
+ + orNotLike(field, val, [pos]) +
+
+ +
+ +
+
+
+ + having(key, [val]) +
+
+ +
+ +
+
+
+ + orHaving(key, [val]) +
+
+ +
+ +
+
+
+ + where(key, [val]) +
+
+ +
+ +
+
+
+ + orWhere(key, [val]) +
+
+ +
+ +
+
+
+ + whereIsNull(field) +
+
+ +
+ +
+
+
+ + whereIsNotNull(field) +
+
+ +
+ +
+
+
+ + orWhereIsNull(field) +
+
+ +
+ +
+
+
+ + orWhereIsNotNull(field) +
+
+ +
+ +
+
+
+ + whereIn(key, values) +
+
+ +
+ +
+
+
+ + orWhereIn(key, values) +
+
+ +
+ +
+
+
+ + whereNotIn(key, values) +
+
+ +
+ +
+
+
+ + orWhereNotIn(key, values) +
+
+ +
+ +
+
+
+ + set(key, [val]) +
+
+ +
+ +
+
+
+ + join(table, cond, [type]) +
+
+ +
+ +
+
+
+ + groupBy(field) +
+
+ +
+ +
+
+
+ + orderBy(field, [type]) +
+
+ +
+ +
+
+
+ + limit(limit, [offset]) +
+
+ +
+ +
+
+
+ + groupStart() +
+
+ +
+ +
+
+
+ + orGroupStart() +
+
+ +
+ +
+
+
+ + orNotGroupStart() +
+
+ +
+ +
+
+
+ + groupEnd() +
+
+ +
+ +
+
+
+ + get([table], [limit], [offset], [callback]) +
+
+ +
+ +
+
+
+ + insert(table, [data], [callback]) +
+
+ +
+ +
+
+
+ + insertBatch(table, data, [callback]) +
+
+ +
+ +
+
+
+ + update(table, [data], [callback]) +
+
+ +
+ +
+
+
+ + delete(table, [where], [callback]) +
+
+ +
+ +
+
+
+ + getCompiledSelect([table], [reset]) +
+
+ +
+ +
+
+
+ + getCompiledInsert(table, [reset]) +
+
+ +
+ +
+
+
+ + getCompiledUpdate(table, [reset]) +
+
+ +
+ +
+
+
+ + getCompiledDelete(table, [reset]) +
+
+ +
+ +
+ + + + + + + + + +
+ + +
+

+ Result +

+ +
+ +

Query result object

-

Parameters

-
    -
  • Array rows - : -
    -

    the data rows of the result

    + +
    new Result(rows: Array, columns: Array)
    + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + rows (Array) the data rows of the result
    -
  • -
  • Array columns - : -
    -

    the column names in the result

    - -
    -
  • -
-

Instance members

-
- - - #columnCount - -
-

Get the number of columns returned by the query

- -
-
-
-
-

- columnCount -

-

Get the number of columns returned by the query

- -

Returns

- Number - : -
-

the number of columns in the result

- -
-
-
+
-
- - - #rowCount - -
-

Get the number of rows returned by the query

+ +
+
+ columns (Array) the column names in the result -
- -
-
-

- rowCount -

-

Get the number of rows returned by the query

- -

Returns

- Number - : -
-

the number of rows in the result

- -
-
+
+ +
+ + + + + + + + + + + + + +
Instance Members
+
+ +
+
+
+ + rowCount() +
+
+ + +
+
+ +
+
+
+ + columnCount()
+
+ +
+ +
+ + + + +
+ + +