不要怂,就是干,撸起袖子干!

Commit 650f533d by Jan Aagaard Meier

alias the queryinterface on hasmany double linked for brevity

1 parent 5ecb1266
Showing with 8 additions and 5 deletions
...@@ -4,6 +4,9 @@ module.exports = (function() { ...@@ -4,6 +4,9 @@ module.exports = (function() {
var HasManyDoubleLinked = function(definition, instance) { var HasManyDoubleLinked = function(definition, instance) {
this.__factory = definition this.__factory = definition
this.instance = instance this.instance = instance
// Alias the quoting methods for code brevity
this.QueryInterface = instance.QueryInterface
} }
HasManyDoubleLinked.prototype.injectGetter = function(options) { HasManyDoubleLinked.prototype.injectGetter = function(options) {
...@@ -35,22 +38,22 @@ module.exports = (function() { ...@@ -35,22 +38,22 @@ module.exports = (function() {
if (!options.attributes) { if (!options.attributes) {
options.attributes = [ options.attributes = [
self.__factory.target.QueryInterface.quoteIdentifier(self.__factory.target.tableName)+".*" self.QueryInterface.quoteIdentifier(self.__factory.target.tableName)+".*"
] ]
} }
if (options.joinTableAttributes) { if (options.joinTableAttributes) {
options.joinTableAttributes.forEach(function (elem) { options.joinTableAttributes.forEach(function (elem) {
options.attributes.push( options.attributes.push(
self.__factory.target.QueryInterface.quoteIdentifiers(self.__factory.connectorDAO.tableName + '.' + elem) + ' as ' + self.QueryInterface.quoteIdentifiers(self.__factory.connectorDAO.tableName + '.' + elem) + ' as ' +
self.__factory.target.QueryInterface.quoteIdentifier(self.__factory.connectorDAO.name + '.' + elem) self.QueryInterface.quoteIdentifier(self.__factory.connectorDAO.name + '.' + elem)
) )
}) })
} else { } else {
Utils._.forOwn(self.__factory.connectorDAO.rawAttributes, function (elem, key) { Utils._.forOwn(self.__factory.connectorDAO.rawAttributes, function (elem, key) {
options.attributes.push( options.attributes.push(
self.__factory.target.QueryInterface.quoteIdentifiers(self.__factory.connectorDAO.tableName + '.' + key) + ' as ' + self.QueryInterface.quoteIdentifiers(self.__factory.connectorDAO.tableName + '.' + key) + ' as ' +
self.__factory.target.QueryInterface.quoteIdentifier(self.__factory.connectorDAO.name + '.' + key) self.QueryInterface.quoteIdentifier(self.__factory.connectorDAO.name + '.' + key)
) )
}) })
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!