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 authored and xavierlacot committed Nov 15, 2013
1 parent 371acb7 commit 061be13
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 @@ -539,6 +543,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 @@ -663,6 +671,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 061be13

Please sign in to comment.