mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Knex: added declarations and tests for clearSelect() and clearWhere(). (#16746)
This commit is contained in:
committed by
Mohamed Hegazy
parent
f3c96a99d1
commit
c35d7a9798
4
types/knex/index.d.ts
vendored
4
types/knex/index.d.ts
vendored
@@ -120,6 +120,10 @@ declare namespace Knex {
|
||||
orHaving: Having;
|
||||
orHavingRaw: RawQueryBuilder;
|
||||
|
||||
// Clear
|
||||
clearSelect(): QueryBuilder;
|
||||
clearWhere(): QueryBuilder;
|
||||
|
||||
// Paging
|
||||
offset(offset: number): QueryBuilder;
|
||||
limit(limit: number): QueryBuilder;
|
||||
|
||||
@@ -406,6 +406,14 @@ knex.table('users').first(knex.raw('round(sum(products)) as p')).then(function(r
|
||||
console.log(row);
|
||||
});
|
||||
|
||||
knex.table('users').select('*').clearSelect().select('id').then(function(rows) {
|
||||
console.log(rows);
|
||||
});
|
||||
|
||||
knex('accounts').where('userid', '=', 1).clearWhere().select().then(function (rows) {
|
||||
console.log(rows);
|
||||
});
|
||||
|
||||
// Using trx as a query builder:
|
||||
knex.transaction(function(trx) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user