mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
knex: first() should accept the same parameters as select()
This commit is contained in:
2
types/knex/index.d.ts
vendored
2
types/knex/index.d.ts
vendored
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user