Merge pull request #22303 from baronfel/joins_with_raw

[knex] allow for right hand side fo a join to be a Raw value, per the docs
This commit is contained in:
Paul van Brenk
2017-12-27 17:22:50 -08:00
committed by GitHub
3 changed files with 8 additions and 10 deletions
+1 -7
View File
@@ -7,13 +7,7 @@ const st: KPG.KnexPostgis = KPG(knex);
const point: GeoJSON.Point = {
type: 'Point',
coordinates: [23.773206, 61.506005],
crs: {
type: 'name',
properties: {
name: 'EPSG:4326'
}
}
coordinates: [23.773206, 61.506005]
};
const wktPoint = 'POINT(23.773206 61.506005)';
+3 -3
View File
@@ -196,19 +196,19 @@ declare namespace Knex {
on(columns: { [key: string]: string | Raw }): JoinClause;
on(column1: string, column2: string): JoinClause;
on(column1: string, raw: Raw): JoinClause;
on(column1: string, operator: string, column2: string): JoinClause;
on(column1: string, operator: string, column2: string | Raw): JoinClause;
andOn(raw: Raw): JoinClause;
andOn(callback: Function): JoinClause;
andOn(columns: { [key: string]: string | Raw }): JoinClause;
andOn(column1: string, column2: string): JoinClause;
andOn(column1: string, raw: Raw): JoinClause;
andOn(column1: string, operator: string, column2: string): JoinClause;
andOn(column1: string, operator: string, column2: string | Raw): JoinClause;
orOn(raw: Raw): JoinClause;
orOn(callback: Function): JoinClause;
orOn(columns: { [key: string]: string | Raw }): JoinClause;
orOn(column1: string, column2: string): JoinClause;
orOn(column1: string, raw: Raw): JoinClause;
orOn(column1: string, operator: string, column2: string): JoinClause;
orOn(column1: string, operator: string, column2: string | Raw): JoinClause;
onIn(column1: string, values: any[]): JoinClause;
andOnIn(column1: string, values: any[]): JoinClause;
orOnIn(column1: string, values: any[]): JoinClause;
+4
View File
@@ -257,6 +257,10 @@ knex.select('*').from('users').join('accounts', function(join: Knex.JoinClause)
join.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
knex.select('*').from('user').join('contacts', () => {
this.on('users.id', '=', knex.raw(7));
});
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onIn('contacts.id', [7, 15, 23, 41])
});