Knex: added declarations and tests for clearSelect() and clearWhere(). (#16746)

This commit is contained in:
Martynas Kunigėlis
2017-06-01 08:39:26 +03:00
committed by Mohamed Hegazy
parent f3c96a99d1
commit c35d7a9798
2 changed files with 12 additions and 0 deletions

View File

@@ -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;

View File

@@ -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) {