Fix some code-style issues and fix jenkins build
This commit is contained in:
parent
7afb44dc20
commit
7f982a4c2b
6
API.md
6
API.md
@ -15,8 +15,10 @@ Create a query builder object
|
|||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
- `driverType` **String** The name of the database type, eg. mysql or pg
|
- `driverType` **String** The name of the database type, eg. mysql or pg
|
||||||
- `connObject` **Object** A connection object from the database library you are connecting with
|
- `connObject` **Object** A connection object from the database library
|
||||||
- `connLib` **[String]** The name of the db connection library you are using, eg. mysql or mysql2. Optional if the same as driverType
|
you are connecting with
|
||||||
|
- `connLib` **[String]** The name of the db connection library you are
|
||||||
|
using, eg. mysql or mysql2. Optional if the same as driverType
|
||||||
|
|
||||||
Returns **QueryBuilder** The Query Builder object
|
Returns **QueryBuilder** The Query Builder object
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 3.2.0
|
## 3.2.0
|
||||||
* Added public `query` method for making arbitrary sql calls
|
* Added public `query` method for making arbitrary sql calls
|
||||||
* Added back tests for `node-query` adapter. Using this adapter with promises is not currently supported.
|
* Added back tests for `node-firebird` adapter. Using this adapter with promises is not currently supported.
|
||||||
|
|
||||||
## 3.1.0
|
## 3.1.0
|
||||||
* Added support for promises on query execution methods
|
* Added support for promises on query execution methods
|
@ -305,14 +305,16 @@
|
|||||||
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>connObject</strong>
|
<li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>connObject</strong>
|
||||||
:
|
:
|
||||||
<div class='force-inline'>
|
<div class='force-inline'>
|
||||||
<p>A connection object from the database library you are connecting with</p>
|
<p>A connection object from the database library
|
||||||
|
you are connecting with</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>connLib</strong>
|
<li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> <strong>connLib</strong>
|
||||||
:
|
:
|
||||||
<div class='force-inline'>
|
<div class='force-inline'>
|
||||||
<p>The name of the db connection library you are using, eg. mysql or mysql2. Optional if the same as driverType</p>
|
<p>The name of the db connection library you are
|
||||||
|
using, eg. mysql or mysql2. Optional if the same as driverType</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -21,7 +21,9 @@ let Driver = {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_quote(str) {
|
_quote(str) {
|
||||||
return (helpers.isString(str) && ! (str.startsWith(Driver.identifierStartChar) || str.endsWith(Driver.identifierEndChar)))
|
return (helpers.isString(str)
|
||||||
|
&& ! (str.startsWith(Driver.identifierStartChar) || str.endsWith(Driver.identifierEndChar))
|
||||||
|
)
|
||||||
? `${Driver.identifierStartChar}${str}${Driver.identifierEndChar}`
|
? `${Driver.identifierStartChar}${str}${Driver.identifierEndChar}`
|
||||||
: str;
|
: str;
|
||||||
},
|
},
|
||||||
|
@ -23,8 +23,10 @@ class NodeQuery {
|
|||||||
* Create a query builder object
|
* Create a query builder object
|
||||||
*
|
*
|
||||||
* @param {String} driverType - The name of the database type, eg. mysql or pg
|
* @param {String} driverType - The name of the database type, eg. mysql or pg
|
||||||
* @param {Object} connObject - A connection object from the database library you are connecting with
|
* @param {Object} connObject - A connection object from the database library
|
||||||
* @param {String} [connLib] - The name of the db connection library you are using, eg. mysql or mysql2. Optional if the same as driverType
|
* you are connecting with
|
||||||
|
* @param {String} [connLib] - The name of the db connection library you are
|
||||||
|
* using, eg. mysql or mysql2. Optional if the same as driverType
|
||||||
* @return {QueryBuilder} - The Query Builder object
|
* @return {QueryBuilder} - The Query Builder object
|
||||||
*/
|
*/
|
||||||
init(driverType, connObject, connLib) {
|
init(driverType, connObject, connLib) {
|
||||||
|
@ -131,7 +131,8 @@ class QueryBuilderBase {
|
|||||||
* @return {Array} - modified state array
|
* @return {Array} - modified state array
|
||||||
*/
|
*/
|
||||||
_mixedSet(/* $letName, $valType, $key, [$val] */) {
|
_mixedSet(/* $letName, $valType, $key, [$val] */) {
|
||||||
let args = getArgs('$letName:string, $valType:string, $key:object|string|number, [$val]', arguments);
|
const argPattern = '$letName:string, $valType:string, $key:object|string|number, [$val]';
|
||||||
|
let args = getArgs(argPattern, arguments);
|
||||||
|
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
|
||||||
@ -784,7 +785,8 @@ class QueryBuilder extends QueryBuilderBase {
|
|||||||
* @return {void|Promise} - If no callback is passed, a promise is returned
|
* @return {void|Promise} - If no callback is passed, a promise is returned
|
||||||
*/
|
*/
|
||||||
get(/* [table], [limit], [offset], [callback] */) {
|
get(/* [table], [limit], [offset], [callback] */) {
|
||||||
let args = getArgs('[table]:string, [limit]:number, [offset]:number, [callback]:function', arguments);
|
const argPattern = '[table]:string, [limit]:number, [offset]:number, [callback]:function';
|
||||||
|
let args = getArgs(argPattern, arguments);
|
||||||
|
|
||||||
if (args.table) {
|
if (args.table) {
|
||||||
this.from(args.table);
|
this.from(args.table);
|
||||||
|
@ -127,7 +127,8 @@ types.forEach(t => {
|
|||||||
* Determine whether a variable is of the type specified in the
|
* Determine whether a variable is of the type specified in the
|
||||||
* function name, eg isNumber
|
* function name, eg isNumber
|
||||||
*
|
*
|
||||||
* Types available are Null, Undefined, Object, Array, String, Number, Boolean, Function, RegExp, NaN and Infinite
|
* Types available are Null, Undefined, Object, Array, String, Number,
|
||||||
|
* Boolean, Function, RegExp, NaN and Infinite
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {mixed} o - The object to check its type
|
* @param {mixed} o - The object to check its type
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const configFile = (process.env.CI) ? '../config-travis.json' : '../config.json';
|
const configFile = (process.env.TRAVIS) ? '../config-travis.json' : '../config.json';
|
||||||
|
|
||||||
// Load the test base
|
// Load the test base
|
||||||
const reload = require('require-reload')(require);
|
const reload = require('require-reload')(require);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const configFile = (process.env.CI) ? '../config-travis.json' : '../config.json';
|
const configFile = (process.env.TRAVIS) ? '../config-travis.json' : '../config.json';
|
||||||
|
|
||||||
// Load the test base
|
// Load the test base
|
||||||
const reload = require('require-reload')(require);
|
const reload = require('require-reload')(require);
|
||||||
|
@ -1,31 +1,32 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Load the test base
|
(() => {
|
||||||
const path = require('path');
|
// Load the test base
|
||||||
const reload = require('require-reload')(require);
|
const path = require('path');
|
||||||
const testBase = reload('../base');
|
const reload = require('require-reload')(require);
|
||||||
const promisify = require('../../lib/promisify');
|
const testBase = reload('../base');
|
||||||
const expect = reload('chai').expect;
|
const promisify = require('../../lib/promisify');
|
||||||
const testRunner = testBase.testRunner;
|
const expect = reload('chai').expect;
|
||||||
const promiseTestRunner = testBase.promiseTestRunner;
|
const testRunner = testBase.testRunner;
|
||||||
|
const promiseTestRunner = testBase.promiseTestRunner;
|
||||||
|
|
||||||
// Load the test config file
|
// Load the test config file
|
||||||
let adapterName = 'node-firebird';
|
let adapterName = 'node-firebird';
|
||||||
let Firebird = reload(adapterName);
|
let Firebird = reload(adapterName);
|
||||||
const config = reload('../config.json')[adapterName];
|
const config = reload('../config.json')[adapterName];
|
||||||
config.conn.database = path.join(__dirname, config.conn.database);
|
config.conn.database = path.join(__dirname, config.conn.database);
|
||||||
let nodeQuery = reload('../../lib/NodeQuery');
|
let nodeQuery = reload('../../lib/NodeQuery');
|
||||||
|
|
||||||
let qb = null;
|
let qb = null;
|
||||||
|
|
||||||
// Skip on TravisCi
|
// Skip on TravisCi
|
||||||
if (process.env.CI || process.env.JENKINS_HOME) {
|
if (process.env.CI) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Promisifying the connection seems to be the only way to get
|
// Promisifying the connection seems to be the only way to get
|
||||||
// this test suite to run consistently.
|
// this test suite to run consistently.
|
||||||
promisify(Firebird.attach)(config.conn).then(db => {
|
promisify(Firebird.attach)(config.conn).then(db => {
|
||||||
qb = nodeQuery.init('firebird', db, adapterName);
|
qb = nodeQuery.init('firebird', db, adapterName);
|
||||||
suite('Firebird adapter tests -', () => {
|
suite('Firebird adapter tests -', () => {
|
||||||
test('nodeQuery.getQuery = nodeQuery.init', () => {
|
test('nodeQuery.getQuery = nodeQuery.init', () => {
|
||||||
@ -35,7 +36,7 @@ promisify(Firebird.attach)(config.conn).then(db => {
|
|||||||
test('insertBatch throws error', () => {
|
test('insertBatch throws error', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
qb.driver.insertBatch('create_test', []);
|
qb.driver.insertBatch('create_test', []);
|
||||||
}).to.throw(Error, "Not Implemented");
|
}).to.throw(Error, 'Not Implemented');
|
||||||
});
|
});
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
Callback Tests
|
Callback Tests
|
||||||
@ -54,6 +55,7 @@ promisify(Firebird.attach)(config.conn).then(db => {
|
|||||||
qb.end();
|
qb.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
});
|
});
|
||||||
|
})();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// jscs:disable
|
||||||
// Load the test base
|
// Load the test base
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
const chaiAsPromised = require('chai-as-promised');
|
const chaiAsPromised = require('chai-as-promised');
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// jscs:disable
|
||||||
// Load the test base
|
// Load the test base
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
const chaiAsPromised = require('chai-as-promised');
|
const chaiAsPromised = require('chai-as-promised');
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// jscs:disable
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'Get tests -': {
|
'Get tests -': {
|
||||||
'Get with function': {
|
'Get with function': {
|
||||||
|
@ -15,7 +15,8 @@ let State = require('../lib/State');
|
|||||||
let state = new State();
|
let state = new State();
|
||||||
|
|
||||||
let mixedSet = function mixedSet(/* $letName, $valType, $key, [$val] */) {
|
let mixedSet = function mixedSet(/* $letName, $valType, $key, [$val] */) {
|
||||||
let args = getArgs('$letName:string, $valType:string, $key:object|string|number, [$val]', arguments);
|
const argPattern = '$letName:string, $valType:string, $key:object|string|number, [$val]';
|
||||||
|
let args = getArgs(argPattern, arguments);
|
||||||
|
|
||||||
let obj = {};
|
let obj = {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user