File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -297,4 +297,10 @@ Table.prototype.indexes = function() {
297297 return new Query ( this ) . indexes ( ) ;
298298} ;
299299
300+ Table . prototype . limit = function ( ) {
301+ var query = new Query ( this ) ;
302+ query . limit . apply ( query , arguments ) ;
303+ return query ;
304+ } ;
305+
300306module . exports = Table ;
Original file line number Diff line number Diff line change @@ -235,3 +235,14 @@ test('dialects', function () {
235235 actual = foo . join ( bar ) . on ( bar . id . equals ( 1 ) ) . toString ( ) ;
236236 assert . equal ( actual , '"foo" INNER JOIN "bar" ON ("bar"."id" = 1)' ) ;
237237} ) ;
238+
239+ test ( 'limit' , function ( ) {
240+ var user = Table . define ( {
241+ name : 'user' ,
242+ columns : [ 'id' , 'name' ]
243+ } ) ;
244+ var query = user . limit ( 3 ) ;
245+ assert . equal ( query . nodes . length , 1 ) ;
246+ assert . equal ( query . nodes [ 0 ] . type , 'LIMIT' ) ;
247+ assert . equal ( query . nodes [ 0 ] . count , 3 ) ;
248+ } ) ;
You can’t perform that action at this time.
0 commit comments