Skip to content

Commit

Permalink
Added .offset() method to joli.query
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhipp committed Aug 28, 2013
1 parent 7d3c98e commit b46dd15
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions joli.js
Expand Up @@ -251,6 +251,10 @@ var joliCreator = function() {
q.limit(constraints.limit);
}

if (constraints.limit && constraints.offset) {
q.offset(constraints.offset);
}

return q.execute();
},
count: function(constraints) {
Expand Down Expand Up @@ -537,6 +541,10 @@ var joliCreator = function() {
query += ' limit ' + this.data.limit;
}

if (this.data.limit && this.data.offset) {
query += ' offset ' + this.data.offset;
}

return query;
},
groupBy: function(group) {
Expand Down Expand Up @@ -661,6 +669,10 @@ var joliCreator = function() {
this.data.limit = limit;
return this;
},
offset: function(offset) {
this.data.offset = offset;
return this;
},
order: function(order) {
if ('string' === joli.getType(order)) {
order = [order];
Expand Down

0 comments on commit b46dd15

Please sign in to comment.