Skip to content
This repository was archived by the owner on May 18, 2024. It is now read-only.

Commit 2cc7587

Browse files
author
Jeongho Nam
committed
Complement #80, JoinQjueryBuilder.getColumn()
1 parent d612f0a commit 2cc7587

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "safe-typeorm",
3-
"version": "2.0.0-dev.20220913-5",
3+
"version": "2.0.0",
44
"description": "Make TypeORM much safer",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

src/builders/JoinQueryBuilder.ts

+13
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,19 @@ export class JoinQueryBuilder<Mine extends object, Query extends object = any> {
402402
condition(this.stmt_.query, ...args);
403403
}
404404

405+
public getColumn<Literal extends SpecialFields<Mine, Field>>(
406+
field: Literal,
407+
): string {
408+
const column: string =
409+
(
410+
ReflectAdaptor.get(
411+
this.mine_.prototype,
412+
field,
413+
) as Belongs.ManyToOne.IMetadata<Mine>
414+
)?.foreign_key_field || field;
415+
return `${this.alias_}.${column}`;
416+
}
417+
405418
/* -----------------------------------------------------------
406419
JOINERS
407420
----------------------------------------------------------- */

0 commit comments

Comments
 (0)