[knex] Enable named bindings in *Raw methods (#25028)

This commit is contained in:
Edo Rivai
2018-04-16 15:17:54 -07:00
committed by Ryan Cavanaugh
parent c78f4617d8
commit 9f0ef7e76e
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -18,6 +18,7 @@ import Bluebird = require("bluebird");
type Callback = Function;
type Client = Function;
type Value = string | number | boolean | Date | Array<string> | Array<number> | Array<Date> | Array<boolean> | Buffer | Knex.Raw;
type ValueMap = { [key: string]: Value };
type ColumnName = string | Knex.Raw | Knex.QueryBuilder | {[key: string]: string };
type TableName = string | Knex.Raw | Knex.QueryBuilder;
@@ -338,7 +339,7 @@ declare namespace Knex {
interface RawQueryBuilder {
(sql: string, ...bindings: Value[]): QueryBuilder;
(sql: string, bindings: Value[]): QueryBuilder;
(sql: string, bindings: Value[] | ValueMap): QueryBuilder;
(raw: Raw): QueryBuilder;
}
@@ -352,7 +353,7 @@ declare namespace Knex {
(value: Value): Raw;
(sql: string, ...bindings: Value[]): Raw;
(sql: string, bindings: Value[]): Raw;
(sql: string, bindings: Object): Raw;
(sql: string, bindings: ValueMap): Raw;
}
//
+1
View File
@@ -246,6 +246,7 @@ knex('users').whereBetween('votes', [1, 100]);
knex('users').whereNotBetween('votes', [1, 100]);
knex('users').whereRaw('id = ?', [1]);
knex('users').whereRaw('id = :id', { id: 1 });
// Join methods
knex('users')