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

Commit c5c1ea6d by sdepold

minor formatting

1 parent cd13012d
......@@ -109,9 +109,9 @@ module.exports = (function() {
}
// options is not a hash but an id
if(typeof options == 'number')
if(typeof options === 'number') {
options = { where: options }
else if (Utils.argsArePrimaryKeys(arguments, this.primaryKeys)) {
} else if (Utils.argsArePrimaryKeys(arguments, this.primaryKeys)) {
var where = {}
, self = this
......@@ -125,7 +125,7 @@ module.exports = (function() {
options.limit = 1
return this.QueryInterface.select(this, this.tableName, options, {plain: true})
return this.QueryInterface.select(this, this.tableName, options, { plain: true })
}
DAOFactory.prototype.count = function(options) {
......
......@@ -111,11 +111,16 @@ module.exports = (function() {
options.where = QueryGenerator.getWhereConditions(options.where)
query += " WHERE <%= where %>"
}
if(options.order) query += " ORDER BY <%= order %>"
if(options.order) {
query += " ORDER BY <%= order %>"
}
if(options.group) {
options.group = Utils.addTicks(options.group)
query += " GROUP BY <%= group %>"
}
if(options.limit) {
if(options.offset) query += " LIMIT <%= offset %>, <%= limit %>"
else query += " LIMIT <%= limit %>"
......@@ -233,14 +238,15 @@ module.exports = (function() {
getWhereConditions: function(smth) {
var result = null
if(Utils.isHash(smth))
if(Utils.isHash(smth)) {
result = QueryGenerator.hashToWhereConditions(smth)
else if(typeof smth == 'number')
} else if(typeof smth === 'number') {
result = Utils.addTicks('id') + "=" + Utils.escape(smth)
else if(typeof smth == "string")
} else if(typeof smth === "string") {
result = smth
else if(Array.isArray(smth))
} else if(Array.isArray(smth)) {
result = Utils.format(smth)
}
return result
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!