From a186837b22c970e3bb21dc4052b8615bdc4b8b31 Mon Sep 17 00:00:00 2001 From: W W Date: Wed, 5 Feb 2020 09:37:37 +0100 Subject: [PATCH 1/5] Som comments --- src/typedKnex.ts | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/src/typedKnex.ts b/src/typedKnex.ts index d484ca1..dd305c6 100644 --- a/src/typedKnex.ts +++ b/src/typedKnex.ts @@ -143,7 +143,7 @@ export interface ITypedQueryBuilder { orWhereNull: IColumnParameterNoRowTransformation; orWhereNotNull: IColumnParameterNoRowTransformation; - leftOuterJoinTableOnFunction: IJoinTableMultipleOnClauses< + leftOuterJoinTableOnFunction: IOuterJoinTableMultipleOnClauses< Model, SelectableModel, Row extends Model ? {} : Row @@ -345,6 +345,27 @@ interface IJoinTableMultipleOnClauses { >; } +interface IOuterJoinTableMultipleOnClauses { + < + NewPropertyType, + NewPropertyKey extends keyof any + >( + newPropertyKey: NewPropertyKey, + newPropertyClass: new () => NewPropertyType, + on: ( + join: IJoinOnClause2< + AddPropertyWithType, + NewPropertyType + > + ) => void + ): ITypedQueryBuilder< + Model, + AddPropertyWithType, + Row + >; +} + + interface ISelectRaw { < TReturn extends Boolean | String | Number, @@ -437,16 +458,34 @@ interface IDbFunctionWithAlias { } +// Removes all optional, undefined and null from type type NonNullableRecursive = { [P in keyof T]-?: T[P] extends object ? T[P] extends NonForeignKeyObjects ? Required> : NonNullableRecursive : Required> }; + + +// take { a : string, b : { c : string }} and return { a : ()=> {a: string}, b : { c : ()=> { b: { c: string } }}} +// Special cases: +// { a: User, b : string[] } returns { a: () => User, b : () => { b: string[] } } +// { a?: string[] } returns { a : () => (null|string[]) } +// { a: User | null } returns { a : () => User } +// Result contains the path to one leaf. {a : { b: string }} will have a Result of ['b', 'a'] type TransformPropertiesToFunction = { - [P in keyof Model]-?: Model[P] extends (object | undefined) ? - Model[P] extends (NonForeignKeyObjects | undefined) ? () => RecordFromArray, ({} extends { [P2 in P]: Model[P] } ? NonNullable | null : Model[P])> : + [P in keyof Model]-?: + // if it's an object + Model[P] extends (object | undefined) ? + // and if it isn't a foreign key + Model[P] extends (NonForeignKeyObjects | undefined) ? + // create leaf with this type + () => RecordFromArray, ({} extends { [P2 in P]: Model[P] } ? NonNullable | null : Model[P])> : + // if it is a foreign key, transform it's properties TransformPropertiesToFunction> : + // if it isn't an object, create leaf with this type () => RecordFromArray, ({} extends { [P2 in P]: Model[P] } ? NonNullable | null : Model[P])> }; +// Creates a type from an array of strings (in reversed order) +// input ['c','b','a'] and string returns { a : { b: { c : string }}} type RecordFromArray = Keys extends { 6: any } ? Record>>>>>> : Keys extends { 5: any } ? Record>>>>> : From eb344ea1b4452a72ef7d19c203ec6e438da9bc62 Mon Sep 17 00:00:00 2001 From: W W Date: Wed, 5 Feb 2020 10:42:06 +0100 Subject: [PATCH 2/5] reshuffle --- src/IsNullable.ts | 1 + src/NonForeignKeyObjects.ts | 1 + src/NonNullableRecursive.ts | 5 ++ src/TransformPropertiesToFunction.ts | 73 ++++++++++++++++++++++++++ src/typedKnex.ts | 76 ++++++---------------------- test/compilation/compilationTests.ts | 39 +++++++++++++- test/unit/typedQueryBuilderTests.ts | 38 +++++++++----- 7 files changed, 159 insertions(+), 74 deletions(-) create mode 100644 src/IsNullable.ts create mode 100644 src/NonForeignKeyObjects.ts create mode 100644 src/NonNullableRecursive.ts create mode 100644 src/TransformPropertiesToFunction.ts diff --git a/src/IsNullable.ts b/src/IsNullable.ts new file mode 100644 index 0000000..3a0a0e1 --- /dev/null +++ b/src/IsNullable.ts @@ -0,0 +1 @@ +export type IsNullable = null extends T ? true : never; diff --git a/src/NonForeignKeyObjects.ts b/src/NonForeignKeyObjects.ts new file mode 100644 index 0000000..23f9be4 --- /dev/null +++ b/src/NonForeignKeyObjects.ts @@ -0,0 +1 @@ +export type NonForeignKeyObjects = any[] | Date; diff --git a/src/NonNullableRecursive.ts b/src/NonNullableRecursive.ts new file mode 100644 index 0000000..6ba4000 --- /dev/null +++ b/src/NonNullableRecursive.ts @@ -0,0 +1,5 @@ +import { NonForeignKeyObjects } from "./NonForeignKeyObjects"; +// Removes all optional, undefined and null from type +export type NonNullableRecursive = { + [P in keyof T]-?: T[P] extends object ? T[P] extends NonForeignKeyObjects ? Required> : NonNullableRecursive : Required>; +}; diff --git a/src/TransformPropertiesToFunction.ts b/src/TransformPropertiesToFunction.ts new file mode 100644 index 0000000..fb11eb1 --- /dev/null +++ b/src/TransformPropertiesToFunction.ts @@ -0,0 +1,73 @@ +import { IsNullable } from './IsNullable'; +import { NonForeignKeyObjects } from './NonForeignKeyObjects'; +// take { a : string, b : { c : string }} and return { a : ()=> {a: string}, b : { c : ()=> { b: { c: string } }}} +// Special cases: +// { a: User, b : string[] } returns { a: () => User, b : () => { b: string[] } } +// { a?: string[] } returns { a : () => (null|string[]) } +// { a: User | null } returns { a : () => User } +// PropertyPath contains the path to one leaf. {a : { b: string }} will have a PropertyPath of ['b', 'a'] +export type TransformPropertiesToFunction = { + [P in keyof Model]-?: + // if it's an object + Model[P] extends (object | undefined | null) ? + // and if it isn't a foreign key + Model[P] extends (NonForeignKeyObjects | undefined) ? + // create leaf with this type + () => RecordFromArray, ({} extends { + [P2 in P]: Model[P]; + } ? NonNullable | null : Model[P])> : + // if it is a foreign key, transform it's properties + // TransformPropertiesToFunction> + // null extends Model ? TransformPropertiesToFunction> + // : TransformPropertiesToFunction> + NonNullable; + }>>> : + // if it isn't an object, create leaf with this type + () => RecordFromArray, ({} extends { + [P2 in P]: Model[P]; + } ? NonNullable | null : Model[P])>; + }; + +// Creates a type from an array of strings (in reversed order) +// input ['c','b','a'] and string returns { a : { b: { c : string }}} +type RecordFromArray = + // Keys extends { 6: any } ? Record>>>>>> : + // Keys extends { 5: any } ? Record>>>>> : + // Keys extends { 4: any } ? Record>>>> : + // Keys extends { 3: any } ? Record>>> : + // Keys extends { 2: any } ? Record>> : + Keys extends { 1: any } ? Record, GetNullIfNullable | Record, LeafType>> : + Keys extends { 0: any } ? Record, LeafType> : + never; + +type GetName = T extends { name: infer X } ? X : never; +type GetNullIfNullable = T extends { nullable: never } ? never : null; +const a = {} as any as { a: string } | never; + + +console.log('a?.a: ', a.a); +console.log('a?.a: ', a?.a); + +const b = {} as any as IsNullable<{}>; +console.log('b: ', b); + + +const c = {} as any as GetNullIfNullable<{ nullable: never }>; +console.log('c: ', c); + + +const c2 = {} as any as GetNullIfNullable<{ nullable: true }>; +console.log('c2: ', c2); + +type AddToArray = ((a: A, ...t: T) => void) extends ((...u: infer U) => void) ? U : never; + + diff --git a/src/typedKnex.ts b/src/typedKnex.ts index dd305c6..4ee9c69 100644 --- a/src/typedKnex.ts +++ b/src/typedKnex.ts @@ -7,6 +7,9 @@ import { getPrimaryKeyColumn, getTableMetadata } from './decorators'; +import { NonForeignKeyObjects } from './NonForeignKeyObjects'; +import { NonNullableRecursive } from './NonNullableRecursive'; +import { TransformPropertiesToFunction } from './TransformPropertiesToFunction'; export function unflatten(o: any): any { if (o instanceof Array) { @@ -360,7 +363,7 @@ interface IOuterJoinTableMultipleOnClauses { ) => void ): ITypedQueryBuilder< Model, - AddPropertyWithType, + AddPropertyWithType, Row >; } @@ -419,10 +422,6 @@ type TransformPropsToFunctionsReturnPropertyName = { () => P }; -type NonForeignKeyObjects = any[] | Date; - - - type TransformPropsToFunctionsReturnPropertyType = { [P in keyof Model]: Model[P] extends object ? @@ -458,51 +457,6 @@ interface IDbFunctionWithAlias { } -// Removes all optional, undefined and null from type -type NonNullableRecursive = { [P in keyof T]-?: T[P] extends object ? T[P] extends NonForeignKeyObjects ? Required> : NonNullableRecursive : Required> }; - - - -// take { a : string, b : { c : string }} and return { a : ()=> {a: string}, b : { c : ()=> { b: { c: string } }}} -// Special cases: -// { a: User, b : string[] } returns { a: () => User, b : () => { b: string[] } } -// { a?: string[] } returns { a : () => (null|string[]) } -// { a: User | null } returns { a : () => User } -// Result contains the path to one leaf. {a : { b: string }} will have a Result of ['b', 'a'] -type TransformPropertiesToFunction = { - [P in keyof Model]-?: - // if it's an object - Model[P] extends (object | undefined) ? - // and if it isn't a foreign key - Model[P] extends (NonForeignKeyObjects | undefined) ? - // create leaf with this type - () => RecordFromArray, ({} extends { [P2 in P]: Model[P] } ? NonNullable | null : Model[P])> : - // if it is a foreign key, transform it's properties - TransformPropertiesToFunction> - : - // if it isn't an object, create leaf with this type - () => RecordFromArray, ({} extends { [P2 in P]: Model[P] } ? NonNullable | null : Model[P])> -}; - -// Creates a type from an array of strings (in reversed order) -// input ['c','b','a'] and string returns { a : { b: { c : string }}} -type RecordFromArray = - Keys extends { 6: any } ? Record>>>>>> : - Keys extends { 5: any } ? Record>>>>> : - Keys extends { 4: any } ? Record>>>> : - Keys extends { 3: any } ? Record>>> : - Keys extends { 2: any } ? Record>> : - Keys extends { 1: any } ? Record> : - Keys extends { 0: any } ? Record : - never; - - - - - -type AddToArray = ((a: A, ...t: T) => void) extends ((...u: infer U) => void) ? U : never; - - interface ISelectWithFunctionColumns3 { < @@ -820,7 +774,7 @@ interface IUnion { function getProxyAndMemories( typedQueryBuilder?: TypedQueryBuilder ) { - let memories = [] as string[]; + const memories = [] as string[]; function allGet(_target: any, name: any): any { if (name === 'memories') { @@ -837,7 +791,7 @@ function getProxyAndMemories( return new Proxy( {}, { - get: allGet + get: allGet, } ); } @@ -845,7 +799,7 @@ function getProxyAndMemories( const root = new Proxy( {}, { - get: allGet + get: allGet, } ); @@ -882,7 +836,7 @@ function getProxyAndMemoriesForArray( return new Proxy( {}, { - get: allGet + get: allGet, } ); } @@ -890,7 +844,7 @@ function getProxyAndMemoriesForArray( const root = new Proxy( { level: 0 }, { - get: allGet + get: allGet, } ); @@ -1188,7 +1142,7 @@ class TypedQueryBuilder this.extraJoinedProperties.push({ name: newPropertyKey, - propertyType: newPropertyType + propertyType: newPropertyType, }); const tableToJoinClass = newPropertyType; @@ -1227,7 +1181,7 @@ class TypedQueryBuilder this.extraJoinedProperties.push({ name: newPropertyKey, - propertyType: newPropertyType + propertyType: newPropertyType, }); const tableToJoinClass = newPropertyType; @@ -1267,7 +1221,7 @@ class TypedQueryBuilder this.queryBuilder.whereRaw(`?? ${operator} ??`, [ column1Name, - column2Name + column2Name, ]); return this; @@ -2014,7 +1968,7 @@ class TypedQueryBuilder ); const column2ArgumentsWithJoinedTable = [ tableToJoinAlias, - ...column2Arguments + ...column2Arguments, ]; knexOnObject.on( this.getColumnName(...column1Arguments), @@ -2027,12 +1981,12 @@ class TypedQueryBuilder const column2Arguments = this.getArgumentsFromColumnFunction(f); const column2ArgumentsWithJoinedTable = [ tableToJoinAlias, - ...column2Arguments + ...column2Arguments, ]; knexOnObject.onNull(column2ArgumentsWithJoinedTable.join('.')); return onObject; - } + }, }; onFunction(onObject as any); diff --git a/test/compilation/compilationTests.ts b/test/compilation/compilationTests.ts index 3714662..b3f478b 100644 --- a/test/compilation/compilationTests.ts +++ b/test/compilation/compilationTests.ts @@ -524,7 +524,7 @@ describe('compile time typed-knex', function() { if (item !== undefined) { console.log(item.user2.numericValue); - console.log(item.otherUser.name); + console.log(item.otherUser?.name); } })(); @@ -537,6 +537,43 @@ describe('compile time typed-knex', function() { done(); }); + + it('should fail leftOuterJoinTableOnFunction result if it is used as not null', done => { + file = project.createSourceFile( + 'test/test4.ts', + ` + import * as knex from 'knex'; + import { TypedKnex } from '../src/typedKnex'; + import { User, UserSetting } from './testEntities'; + + + (async () => { + + const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); + + const item = await typedKnex + .query(UserSetting) + .leftOuterJoinTableOnFunction('otherUser', User, join => { + join.onColumns(i => i.user2Id, '=', j => j.id); + }) + .select(i => [i.otherUser.name, i.user2.numericValue]) + .getFirst(); + + if (item !== undefined) { + console.log(item.user2.numericValue); + console.log(item.otherUser.name); + } + + })(); + ` + ); + + assert.equal(project.getPreEmitDiagnostics().length, 1); + + file.delete(); + done(); + }); + it('should not return type from leftOuterJoinTableOnFunction with not selected from joined table', done => { file = project.createSourceFile( 'test/test4.ts', diff --git a/test/unit/typedQueryBuilderTests.ts b/test/unit/typedQueryBuilderTests.ts index d3ce09e..802f92b 100644 --- a/test/unit/typedQueryBuilderTests.ts +++ b/test/unit/typedQueryBuilderTests.ts @@ -1297,23 +1297,37 @@ describe('TypedKnexQueryBuilder', () => { }); // it('should stay commented out', async done => { + // const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); + // const query = typedKnex + // .query(UserSetting) + // .innerJoinTableOnFunction('otherUser', User, join => { + // join.onColumns(i => i.user2Id, '=', j => j.id); + // join.onNull(i => i.name); + // }) + // .select(i => i.otherUser.birthDate); - // // const item = await typedKnex - // // .query(UserSetting) - // // .insertItem({ id: '1', key: }); + // const a = await query.getFirst(); + // console.log('a: ', a.otherUser.birthDate); + // console.log('a: ', a.otherUser?.birthDate); - // const item = await typedKnex - // .query(User) - // .select(i => i.category.name) - // .getFirst(); + // done(); + // }); - // console.log('item: ', item.category.name); + // it('should stay commented out', async done => { - // // if (item !== undefined) { - // // console.log(item.user2.numericValue); - // // console.log(item.otherUser.name); - // // } + // const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); + // const query = typedKnex + // .query(UserSetting) + // .leftOuterJoinTableOnFunction('otherUser', User, join => { + // join.onColumns(i => i.user2Id, '=', j => j.id); + // join.onNull(i => i.name); + // }) + // .select(i => i.otherUser.birthDate); + + // const a = await query.getFirst(); + // console.log('a: ', a.otherUser.birthDate); + // console.log('a: ', a.otherUser?.birthDate); // done(); // }); From a3bbd3d8e1e40cd378f6db55ecea50db8a0e6268 Mon Sep 17 00:00:00 2001 From: W W Date: Wed, 5 Feb 2020 10:48:52 +0100 Subject: [PATCH 3/5] prettier --- src/NonNullableRecursive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NonNullableRecursive.ts b/src/NonNullableRecursive.ts index 6ba4000..2a8be53 100644 --- a/src/NonNullableRecursive.ts +++ b/src/NonNullableRecursive.ts @@ -1,4 +1,4 @@ -import { NonForeignKeyObjects } from "./NonForeignKeyObjects"; +import { NonForeignKeyObjects } from './NonForeignKeyObjects'; // Removes all optional, undefined and null from type export type NonNullableRecursive = { [P in keyof T]-?: T[P] extends object ? T[P] extends NonForeignKeyObjects ? Required> : NonNullableRecursive : Required>; From 8cc714cadd90c786f3e3381f349c408db9b3936c Mon Sep 17 00:00:00 2001 From: W W Date: Wed, 5 Feb 2020 14:03:52 +0100 Subject: [PATCH 4/5] try outerJoinColumn --- .prettierrc.toml | 2 ++ src/TransformPropertiesToFunction.ts | 47 ++++++++++------------------ src/typedKnex.ts | 21 ++++++++----- test/testEntities.ts | 2 ++ test/unit/typedQueryBuilderTests.ts | 34 +++++++++++++++++++- 5 files changed, 68 insertions(+), 38 deletions(-) create mode 100644 .prettierrc.toml diff --git a/.prettierrc.toml b/.prettierrc.toml new file mode 100644 index 0000000..a0d4875 --- /dev/null +++ b/.prettierrc.toml @@ -0,0 +1,2 @@ +tabWidth = 4 +printWidth = 220 diff --git a/src/TransformPropertiesToFunction.ts b/src/TransformPropertiesToFunction.ts index fb11eb1..efe71cd 100644 --- a/src/TransformPropertiesToFunction.ts +++ b/src/TransformPropertiesToFunction.ts @@ -1,11 +1,20 @@ import { IsNullable } from './IsNullable'; import { NonForeignKeyObjects } from './NonForeignKeyObjects'; -// take { a : string, b : { c : string }} and return { a : ()=> {a: string}, b : { c : ()=> { b: { c: string } }}} + +// Gets the name of the property +type GetName = T extends { name: infer X } ? X : never; +type GetNullIfNullable = T extends { nullable: never } ? never : null; +// Add an object to an already existing array +type AddToArray = ((a: A, ...t: T) => void) extends ((...u: infer U) => void) ? U : never; + + + +// Take { a : string, b : { c : string }} and return { a : ()=> {a: string}, b : { c : ()=> { b: { c: string } }}} +// PropertyPath contains the path to one leaf. {a : { b: string }} will have a PropertyPath of [{name:'b'}, {name:'a'}] // Special cases: // { a: User, b : string[] } returns { a: () => User, b : () => { b: string[] } } -// { a?: string[] } returns { a : () => (null|string[]) } -// { a: User | null } returns { a : () => User } -// PropertyPath contains the path to one leaf. {a : { b: string }} will have a PropertyPath of ['b', 'a'] +// { a?: string[] } returns { a : () => (string[] | null) } +// { a: (User | null) } returns { a : () => User } (because you want to navigate the foreign keys when SELECT-ing) export type TransformPropertiesToFunction | null : Model[P])> : // if it is a foreign key, transform it's properties - // TransformPropertiesToFunction> - // null extends Model ? TransformPropertiesToFunction> - // : TransformPropertiesToFunction> NonNullable; @@ -37,37 +43,18 @@ export type TransformPropertiesToFunction | null : Model[P])>; }; + // Creates a type from an array of strings (in reversed order) -// input ['c','b','a'] and string returns { a : { b: { c : string }}} +// input [{ name: 'c'} ,{name: 'b'},{ name:'a'}] and string returns { a : { b: { c : string }}} type RecordFromArray = // Keys extends { 6: any } ? Record>>>>>> : // Keys extends { 5: any } ? Record>>>>> : // Keys extends { 4: any } ? Record>>>> : - // Keys extends { 3: any } ? Record>>> : - // Keys extends { 2: any } ? Record>> : + Keys extends { 3: any } ? Record, GetNullIfNullable | Record, GetNullIfNullable | Record, GetNullIfNullable | Record, LeafType>>>> : + Keys extends { 2: any } ? Record, GetNullIfNullable | Record, GetNullIfNullable | Record, LeafType>>> : Keys extends { 1: any } ? Record, GetNullIfNullable | Record, LeafType>> : Keys extends { 0: any } ? Record, LeafType> : never; -type GetName = T extends { name: infer X } ? X : never; -type GetNullIfNullable = T extends { nullable: never } ? never : null; -const a = {} as any as { a: string } | never; - - -console.log('a?.a: ', a.a); -console.log('a?.a: ', a?.a); - -const b = {} as any as IsNullable<{}>; -console.log('b: ', b); - - -const c = {} as any as GetNullIfNullable<{ nullable: never }>; -console.log('c: ', c); - - -const c2 = {} as any as GetNullIfNullable<{ nullable: true }>; -console.log('c2: ', c2); - -type AddToArray = ((a: A, ...t: T) => void) extends ((...u: infer U) => void) ? U : never; diff --git a/src/typedKnex.ts b/src/typedKnex.ts index 4ee9c69..8b9f5b7 100644 --- a/src/typedKnex.ts +++ b/src/typedKnex.ts @@ -137,7 +137,7 @@ export interface ITypedQueryBuilder { orderBy: IOrderBy; innerJoinColumn: IKeyFunctionAsParametersReturnQueryBuider; - leftOuterJoinColumn: IKeyFunctionAsParametersReturnQueryBuider; + leftOuterJoinColumn: IOuterJoin; whereColumn: IWhereCompareTwoColumns; @@ -369,6 +369,19 @@ interface IOuterJoinTableMultipleOnClauses { } + +interface IOuterJoin { + ( + selectColumnFunction: ( + c: TransformPropertiesToFunction + ) => void + ): ITypedQueryBuilder; + + +} + + + interface ISelectRaw { < TReturn extends Boolean | String | Number, @@ -674,12 +687,6 @@ interface IKeyFunctionAsParametersReturnQueryBuider ) => void ): ITypedQueryBuilder; - ( - selectColumnFunction: ( - c: TransformPropertiesToFunction> - ) => void, - setToNullIfNullFunction: (r: Row) => void - ): ITypedQueryBuilder; } interface IWhere { diff --git a/test/testEntities.ts b/test/testEntities.ts index 5852053..aca1545 100644 --- a/test/testEntities.ts +++ b/test/testEntities.ts @@ -68,4 +68,6 @@ export class UserSetting { public value!: string; @Column() public initialValue!: string; + @Column({ name: 'user3Id' }) + public user3?: User; } diff --git a/test/unit/typedQueryBuilderTests.ts b/test/unit/typedQueryBuilderTests.ts index 802f92b..d99acd8 100644 --- a/test/unit/typedQueryBuilderTests.ts +++ b/test/unit/typedQueryBuilderTests.ts @@ -1330,5 +1330,37 @@ describe('TypedKnexQueryBuilder', () => { // console.log('a: ', a.otherUser?.birthDate); // done(); - // }); + // }) + + + it('should stay commented out', async done => { + + const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); + const query = typedKnex + .query(UserSetting) + .innerJoinColumn(i => i.user3) + .select(i => i.user3.birthDate); + + const a = await query.getFirst(); + console.log('a: ', a.user3.birthDate); + console.log('a: ', a.user3?.birthDate); + + done(); + }); + + it('should stay commented out', async done => { + + const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); + const query = typedKnex + .query(UserSetting) + .leftOuterJoinColumn(i => i.user3) + .select(i => i.user3.birthDate); + + const a = await query.getFirst(); + console.log('a: ', a.user3.birthDate); + console.log('a: ', a.user3?.birthDate); + + done(); + }); + }); From c6c1338c015f3f492dab9b7c6a8bd24042ba9f60 Mon Sep 17 00:00:00 2001 From: W W Date: Wed, 5 Feb 2020 15:59:54 +0100 Subject: [PATCH 5/5] skip test --- test/unit/typedQueryBuilderTests.ts | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/unit/typedQueryBuilderTests.ts b/test/unit/typedQueryBuilderTests.ts index 62381eb..e7ede7b 100644 --- a/test/unit/typedQueryBuilderTests.ts +++ b/test/unit/typedQueryBuilderTests.ts @@ -1375,34 +1375,34 @@ describe('TypedKnexQueryBuilder', () => { // }) - it('should stay commented out', async done => { + // it('should stay commented out', async done => { - const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); - const query = typedKnex - .query(UserSetting) - .innerJoinColumn(i => i.user3) - .select(i => i.user3.birthDate); + // const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); + // const query = typedKnex + // .query(UserSetting) + // .innerJoinColumn(i => i.user3) + // .select(i => i.user3.birthDate); - const a = await query.getFirst(); - console.log('a: ', a.user3.birthDate); - console.log('a: ', a.user3?.birthDate); + // const a = await query.getFirst(); + // console.log('a: ', a.user3.birthDate); + // console.log('a: ', a.user3?.birthDate); - done(); - }); + // done(); + // }); - it('should stay commented out', async done => { + // it('should stay commented out', async done => { - const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); - const query = typedKnex - .query(UserSetting) - .leftOuterJoinColumn(i => i.user3) - .select(i => i.user3.birthDate); + // const typedKnex = new TypedKnex(knex({ client: 'postgresql' })); + // const query = typedKnex + // .query(UserSetting) + // .leftOuterJoinColumn(i => i.user3) + // .select(i => i.user3.birthDate); - const a = await query.getFirst(); - console.log('a: ', a.user3.birthDate); - console.log('a: ', a.user3?.birthDate); + // const a = await query.getFirst(); + // console.log('a: ', a.user3.birthDate); + // console.log('a: ', a.user3?.birthDate); - done(); - }); + // done(); + // }); });