Skip to content

Commit

Permalink
added groupBy function, also added it in the appropriate alphabetic o…
Browse files Browse the repository at this point in the history
…rder ;)
  • Loading branch information
karb committed Apr 28, 2011
1 parent 8cb13db commit 80b55d3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions joli.js
Expand Up @@ -494,6 +494,10 @@ joli.query.prototype = {
query += ' where ' + this.data.where;
}

if (this.data.groupBy) {
query += ' group by ' + this.data.groupBy.join(', ');
}

if (this.data.order.length > 0) {
query += ' order by ' + this.data.order.join(', ');
}
Expand All @@ -505,6 +509,15 @@ joli.query.prototype = {
return query;
},

groupBy: function(group) {
if ('string' == joli.getType(group)) {
group = [group];
}

this.data.groupBy = group;
return this;
},

hydrate: function(rows) {
var result = [];

Expand Down

0 comments on commit 80b55d3

Please sign in to comment.