knex: first() should accept the same parameters as select()

This commit is contained in:
Jeremy Marzka
2017-05-22 11:52:42 -05:00
parent 6a7322a32d
commit 2f931b8761
2 changed files with 5 additions and 1 deletions

View File

@@ -136,7 +136,7 @@ declare namespace Knex {
decrement(columnName: string, amount?: number): QueryBuilder;
// Others
first(...columns: string[]): QueryBuilder;
first: Select;
debug(enabled?: boolean): QueryBuilder;
pluck(column: string): QueryBuilder;

View File

@@ -401,6 +401,10 @@ knex.table('users').first('id', 'name').then(function(row) {
console.log(row);
});
knex.table('users').first(knex.raw('round(sum(products)) as p')).then(function(row) {
console.log(row);
});
// Using trx as a query builder:
knex.transaction(function(trx) {