Skip to content

Commit

Permalink
fix(querybuilder): pass builder to formatter instance
Browse files Browse the repository at this point in the history
knex introduced a breaking change where new instance of formatter can only be generated with builder
instance

fix #294
  • Loading branch information
thetutlage committed Feb 9, 2018
1 parent 332f800 commit 882e1cb
Show file tree
Hide file tree
Showing 6 changed files with 1,127 additions and 472 deletions.
26 changes: 0 additions & 26 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,6 @@
const _ = require('lodash')
const pluralize = require('pluralize')

/**
* Copy/pasted from knex
*
* @type {Object}
*/
const dialectAliases = {
'mariadb': 'maria',
'mariasql': 'maria',
'pg': 'postgres',
'postgresql': 'postgres',
'sqlite': 'sqlite3'
}

const util = exports = module.exports = {}

/**
Expand Down Expand Up @@ -118,19 +105,6 @@ util.makePivotTableName = function (modelName, relatedModelName) {
return _.sortBy([modelName, relatedModelName]).join('_')
}

/**
* Returns the dialect client class
*
* @method getKnexDialect
*
* @param {String} name
*
* @return {Client}
*/
util.getKnexDialect = function (name) {
return require(`knex/lib/dialects/${dialectAliases[name] || name}/index.js`)
}

/**
* Tells whether a value exists or not, by checking for
* null and undefined only
Expand Down
Loading

0 comments on commit 882e1cb

Please sign in to comment.