@simplysm/orm-common 13.0.82 → 13.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +106 -0
  2. package/dist/ddl/initialize.d.ts +2 -2
  3. package/dist/ddl/initialize.js +1 -1
  4. package/dist/ddl/initialize.js.map +1 -1
  5. package/dist/ddl/table-ddl.d.ts +1 -1
  6. package/dist/exec/queryable.d.ts +115 -115
  7. package/dist/exec/queryable.js +68 -68
  8. package/dist/exec/queryable.js.map +1 -1
  9. package/dist/expr/expr.d.ts +248 -248
  10. package/dist/expr/expr.js +250 -250
  11. package/dist/query-builder/base/expr-renderer-base.d.ts +7 -7
  12. package/dist/query-builder/mssql/mssql-expr-renderer.d.ts +3 -3
  13. package/dist/query-builder/mssql/mssql-expr-renderer.d.ts.map +1 -1
  14. package/dist/query-builder/mssql/mssql-expr-renderer.js +5 -5
  15. package/dist/query-builder/mssql/mssql-query-builder.d.ts +2 -2
  16. package/dist/query-builder/mssql/mssql-query-builder.d.ts.map +1 -1
  17. package/dist/query-builder/mssql/mssql-query-builder.js +7 -7
  18. package/dist/query-builder/mysql/mysql-expr-renderer.d.ts +2 -2
  19. package/dist/query-builder/mysql/mysql-expr-renderer.d.ts.map +1 -1
  20. package/dist/query-builder/mysql/mysql-expr-renderer.js +4 -4
  21. package/dist/query-builder/mysql/mysql-query-builder.d.ts +10 -10
  22. package/dist/query-builder/mysql/mysql-query-builder.d.ts.map +1 -1
  23. package/dist/query-builder/mysql/mysql-query-builder.js +4 -4
  24. package/dist/query-builder/postgresql/postgresql-expr-renderer.d.ts +2 -2
  25. package/dist/query-builder/postgresql/postgresql-expr-renderer.d.ts.map +1 -1
  26. package/dist/query-builder/postgresql/postgresql-expr-renderer.js +4 -4
  27. package/dist/query-builder/postgresql/postgresql-query-builder.d.ts +8 -8
  28. package/dist/query-builder/postgresql/postgresql-query-builder.d.ts.map +1 -1
  29. package/dist/query-builder/postgresql/postgresql-query-builder.js +7 -7
  30. package/dist/query-builder/query-builder.d.ts +1 -1
  31. package/dist/schema/factory/column-builder.d.ts +46 -46
  32. package/dist/schema/factory/column-builder.js +25 -25
  33. package/dist/schema/factory/index-builder.d.ts +22 -22
  34. package/dist/schema/factory/index-builder.js +14 -14
  35. package/dist/schema/factory/relation-builder.d.ts +93 -93
  36. package/dist/schema/factory/relation-builder.d.ts.map +1 -1
  37. package/dist/schema/factory/relation-builder.js +37 -37
  38. package/dist/schema/procedure-builder.d.ts +38 -38
  39. package/dist/schema/procedure-builder.d.ts.map +1 -1
  40. package/dist/schema/procedure-builder.js +26 -26
  41. package/dist/schema/table-builder.d.ts +38 -38
  42. package/dist/schema/table-builder.d.ts.map +1 -1
  43. package/dist/schema/table-builder.js +29 -29
  44. package/dist/schema/view-builder.d.ts +26 -26
  45. package/dist/schema/view-builder.d.ts.map +1 -1
  46. package/dist/schema/view-builder.js +18 -18
  47. package/dist/types/db.d.ts +40 -40
  48. package/dist/types/expr.d.ts +75 -75
  49. package/dist/types/expr.d.ts.map +1 -1
  50. package/dist/types/query-def.d.ts +32 -32
  51. package/dist/types/query-def.d.ts.map +1 -1
  52. package/docs/db-context.md +238 -0
  53. package/docs/expressions.md +413 -0
  54. package/docs/query-builder.md +198 -0
  55. package/docs/queryable.md +420 -0
  56. package/docs/schema-builders.md +216 -0
  57. package/docs/types-and-utilities.md +353 -0
  58. package/package.json +4 -3
  59. package/src/ddl/initialize.ts +16 -16
  60. package/src/ddl/table-ddl.ts +1 -1
  61. package/src/exec/queryable.ts +163 -163
  62. package/src/expr/expr.ts +257 -257
  63. package/src/query-builder/base/expr-renderer-base.ts +8 -8
  64. package/src/query-builder/mssql/mssql-expr-renderer.ts +20 -20
  65. package/src/query-builder/mssql/mssql-query-builder.ts +28 -28
  66. package/src/query-builder/mysql/mysql-expr-renderer.ts +22 -22
  67. package/src/query-builder/mysql/mysql-query-builder.ts +65 -65
  68. package/src/query-builder/postgresql/postgresql-expr-renderer.ts +15 -15
  69. package/src/query-builder/postgresql/postgresql-query-builder.ts +43 -43
  70. package/src/query-builder/query-builder.ts +1 -1
  71. package/src/schema/factory/column-builder.ts +48 -48
  72. package/src/schema/factory/index-builder.ts +22 -22
  73. package/src/schema/factory/relation-builder.ts +95 -95
  74. package/src/schema/procedure-builder.ts +38 -38
  75. package/src/schema/table-builder.ts +38 -38
  76. package/src/schema/view-builder.ts +28 -28
  77. package/src/types/db.ts +41 -41
  78. package/src/types/expr.ts +79 -79
  79. package/src/types/query-def.ts +37 -37
  80. package/tests/ddl/basic.expected.ts +8 -8
@@ -5,8 +5,8 @@
5
5
  /**
6
6
  * Index definition builder
7
7
  *
8
- * Fluent API를 통해 Index column, 유니크 여부, sorting 순서를 definition
9
- * TableBuilder.indexes()used in
8
+ * Define Index columns, uniqueness, and sort order via Fluent API
9
+ * Used in TableBuilder.indexes()
10
10
  *
11
11
  * @template TKeys - Index column key array type
12
12
  *
@@ -20,13 +20,13 @@
20
20
  * createdAt: c.datetime(),
21
21
  * }))
22
22
  * .indexes((i) => [
23
- * // 유니크 Index
23
+ * // Unique index
24
24
  * i.index("email").unique(),
25
25
  *
26
- * // 복합 Index + sorting order
26
+ * // Composite index + sort order
27
27
  * i.index("name", "createdAt").orderBy("ASC", "DESC"),
28
28
  *
29
- * // 커스텀 이름
29
+ * // Custom name
30
30
  * i.index("createdAt").name("IX_User_CreatedAt"),
31
31
  * ]);
32
32
  * ```
@@ -38,9 +38,9 @@ export class IndexBuilder<TKeys extends string[]> {
38
38
  /**
39
39
  * @param meta - Index Metadata
40
40
  * @param meta.columns - Index column array
41
- * @param meta.name - Index 이름 (Select)
42
- * @param meta.unique - 유니크 Index 여부
43
- * @param meta.orderBy - Column별 sorting order
41
+ * @param meta.name - Index name (optional)
42
+ * @param meta.unique - Whether it is a unique index
43
+ * @param meta.orderBy - Sort order per column
44
44
  * @param meta.description - Index description
45
45
  */
46
46
  constructor(
@@ -56,7 +56,7 @@ export class IndexBuilder<TKeys extends string[]> {
56
56
  /**
57
57
  * Index set name
58
58
  *
59
- * @param name - Index 이름
59
+ * @param name - Index name
60
60
  * @returns new IndexBuilder instance
61
61
  *
62
62
  * @example
@@ -69,7 +69,7 @@ export class IndexBuilder<TKeys extends string[]> {
69
69
  }
70
70
 
71
71
  /**
72
- * 유니크 Index 설정
72
+ * Unique index configuration
73
73
  *
74
74
  * @returns new IndexBuilder instance
75
75
  *
@@ -83,19 +83,19 @@ export class IndexBuilder<TKeys extends string[]> {
83
83
  }
84
84
 
85
85
  /**
86
- * sorting order 설정
86
+ * Sort order configuration
87
87
  *
88
- * column에 대해 ASC 또는 DESC 지정
88
+ * Specify ASC or DESC for each column
89
89
  *
90
- * @param orderBy - Column별 sorting order (column 수와 동일해야 )
90
+ * @param orderBy - Sort order per column (must match the number of columns)
91
91
  * @returns new IndexBuilder instance
92
92
  *
93
93
  * @example
94
94
  * ```typescript
95
- * // 단일 column
95
+ * // Single column
96
96
  * i.index("createdAt").orderBy("DESC")
97
97
  *
98
- * // 복합 column
98
+ * // Composite column
99
99
  * i.index("status", "createdAt").orderBy("ASC", "DESC")
100
100
  * ```
101
101
  */
@@ -106,7 +106,7 @@ export class IndexBuilder<TKeys extends string[]> {
106
106
  /**
107
107
  * Index set description
108
108
  *
109
- * @param description - Index description (DDL Comment으로 사용)
109
+ * @param description - Index description (used as DDL Comment)
110
110
  * @returns new IndexBuilder instance
111
111
  */
112
112
  description(description: string): IndexBuilder<TKeys> {
@@ -119,12 +119,12 @@ export class IndexBuilder<TKeys extends string[]> {
119
119
  // ============================================
120
120
 
121
121
  /**
122
- * Index builder factory Generate
122
+ * Index builder factory creation
123
123
  *
124
- * TableBuilder.indexes()used in하는 Index factory
124
+ * Index factory used in TableBuilder.indexes()
125
125
  *
126
126
  * @template TColumnKey - Table column key type
127
- * @returns Index Generate 메서드를 포함한 object
127
+ * @returns Object containing Index creation methods
128
128
  *
129
129
  * @example
130
130
  * ```typescript
@@ -148,13 +148,13 @@ export function createIndexFactory<TColumnKey extends string>() {
148
148
  * Index Generate
149
149
  *
150
150
  * @template TKeys - Index column key array type
151
- * @param columns - Index column명들
151
+ * @param columns - Index column names
152
152
  * @returns IndexBuilder instance
153
153
  *
154
154
  * @example
155
155
  * ```typescript
156
- * i.index("email") // 단일 column
157
- * i.index("name", "email") // 복합 column
156
+ * i.index("email") // Single column
157
+ * i.index("name", "email") // Composite column
158
158
  * ```
159
159
  */
160
160
  index<TKeys extends TColumnKey[]>(...columns: [...TKeys]): IndexBuilder<TKeys> {
@@ -7,13 +7,13 @@ import type { ViewBuilder } from "../view-builder";
7
7
  // ============================================
8
8
 
9
9
  /**
10
- * Foreign Key relationship builder (N:1)
10
+ * Foreign Key relation builder (N:1)
11
11
  *
12
- * 현재 Table에서 참조 Table로의 FK relationship definition
13
- * DB에 실제 FK constraint Generate
12
+ * Define FK relation from current Table to target Table
13
+ * Creates actual FK constraint in the DB
14
14
  *
15
- * @template TOwner - 소유 Table builder type
16
- * @template TTargetFn - 참조 Table builder factory type
15
+ * @template TOwner - Owner Table builder type
16
+ * @template TTargetFn - Target Table builder factory type
17
17
  *
18
18
  * @example
19
19
  * ```typescript
@@ -29,8 +29,8 @@ import type { ViewBuilder } from "../view-builder";
29
29
  * }));
30
30
  * ```
31
31
  *
32
- * @see {@link ForeignKeyTargetBuilder} 역참조 builder
33
- * @see {@link RelationKeyBuilder} DB FK 없는 relationship
32
+ * @see {@link ForeignKeyTargetBuilder} Reverse-reference builder
33
+ * @see {@link RelationKeyBuilder} Relation without DB FK
34
34
  */
35
35
  export class ForeignKeyBuilder<
36
36
  TOwner extends TableBuilder<any, any>,
@@ -38,10 +38,10 @@ export class ForeignKeyBuilder<
38
38
  > {
39
39
  /**
40
40
  * @param meta - FK Metadata
41
- * @param meta.ownerFn - 소유 Table factory
42
- * @param meta.columns - FK column array
43
- * @param meta.targetFn - 참조 Table factory
44
- * @param meta.description - relationship description
41
+ * @param meta.ownerFn - Owner Table factory
42
+ * @param meta.columns - FK column name array
43
+ * @param meta.targetFn - Target Table factory
44
+ * @param meta.description - Relation description
45
45
  */
46
46
  constructor(
47
47
  readonly meta: {
@@ -53,10 +53,10 @@ export class ForeignKeyBuilder<
53
53
  ) {}
54
54
 
55
55
  /**
56
- * relationship set description
56
+ * Set relation description
57
57
  *
58
- * @param desc - relationship description
59
- * @returns ForeignKeyBuilder instance
58
+ * @param desc - Relation description
59
+ * @returns New ForeignKeyBuilder instance
60
60
  */
61
61
  description(desc: string): ForeignKeyBuilder<TOwner, TTargetFn> {
62
62
  return new ForeignKeyBuilder({ ...this.meta, description: desc });
@@ -64,13 +64,13 @@ export class ForeignKeyBuilder<
64
64
  }
65
65
 
66
66
  /**
67
- * Foreign Key 역참조 builder (1:N)
67
+ * Foreign Key reverse-reference builder (1:N)
68
68
  *
69
- * 다른 Table에서 현재 Table 참조하는 FK의 역참조 definition
70
- * include() 배열로 로드 (single() 호출 시 단일 object)
69
+ * Define reverse-reference for FK from another Table referencing current Table
70
+ * Loaded as array on include() (single object when single() is called)
71
71
  *
72
- * @template TTargetTableFn - 참조하는 Table builder factory type
73
- * @template TIsSingle - 단일 object 여부
72
+ * @template TTargetTableFn - Referencing Table builder factory type
73
+ * @template TIsSingle - Whether it is a single object
74
74
  *
75
75
  * @example
76
76
  * ```typescript
@@ -84,7 +84,7 @@ export class ForeignKeyBuilder<
84
84
  * // 1:N relationship - User ← Post.author
85
85
  * posts: r.foreignKeyTarget(() => Post, "author"),
86
86
  *
87
- * // 1:1 relationship (단일 object)
87
+ * // 1:1 relation (single object)
88
88
  * profile: r.foreignKeyTarget(() => Profile, "user").single(),
89
89
  * }));
90
90
  * ```
@@ -96,11 +96,11 @@ export class ForeignKeyTargetBuilder<
96
96
  TIsSingle extends boolean,
97
97
  > {
98
98
  /**
99
- * @param meta - FK 역참조 Metadata
100
- * @param meta.targetTableFn - 참조하는 Table factory
101
- * @param meta.relationName - 참조하는 Table의 FK 관계명
102
- * @param meta.description - relationship description
103
- * @param meta.isSingle - 단일 object 여부
99
+ * @param meta - FK reverse-reference Metadata
100
+ * @param meta.targetTableFn - Referencing Table factory
101
+ * @param meta.relationName - FK relation name of the referencing Table
102
+ * @param meta.description - Relation description
103
+ * @param meta.isSingle - Whether it is a single object
104
104
  */
105
105
  constructor(
106
106
  readonly meta: {
@@ -112,21 +112,21 @@ export class ForeignKeyTargetBuilder<
112
112
  ) {}
113
113
 
114
114
  /**
115
- * relationship set description
115
+ * Set relation description
116
116
  *
117
- * @param desc - relationship description
118
- * @returns ForeignKeyTargetBuilder instance
117
+ * @param desc - Relation description
118
+ * @returns New ForeignKeyTargetBuilder instance
119
119
  */
120
120
  description(desc: string): ForeignKeyTargetBuilder<TTargetTableFn, TIsSingle> {
121
121
  return new ForeignKeyTargetBuilder({ ...this.meta, description: desc });
122
122
  }
123
123
 
124
124
  /**
125
- * 단일 object 관계로 설정 (1:1)
125
+ * Set as single object relation (1:1)
126
126
  *
127
- * Basic은 array (1:N), single() 호출 시 단일 object
127
+ * Default is array (1:N), single object when single() is called
128
128
  *
129
- * @returns ForeignKeyTargetBuilder instance (isSingle=true)
129
+ * @returns New ForeignKeyTargetBuilder instance (isSingle=true)
130
130
  *
131
131
  * @example
132
132
  * ```typescript
@@ -139,29 +139,29 @@ export class ForeignKeyTargetBuilder<
139
139
  }
140
140
 
141
141
  // ============================================
142
- // RelationKeyBuilder (FK 동일하지만 DB에 FK 등록 안 함)
142
+ // RelationKeyBuilder (same as FK but does not register FK in DB)
143
143
  // ============================================
144
144
 
145
145
  /**
146
- * 논리적 relationship builder (N:1) - DB FK 미생성
146
+ * Logical relation builder (N:1) - No DB FK creation
147
147
  *
148
- * ForeignKeyBuilder 동일하지만 DB에 FK 제약조건을 생성하지 않음
149
- * View(View)에서도 사용 가능
148
+ * Same as ForeignKeyBuilder but does not create FK constraints in the DB
149
+ * Can also be used in Views
150
150
  *
151
- * @template TOwner - 소유 Table/View builder type
152
- * @template TTargetFn - 참조 Table/View builder factory type
151
+ * @template TOwner - Owner Table/View builder type
152
+ * @template TTargetFn - Target Table/View builder factory type
153
153
  *
154
154
  * @example
155
155
  * ```typescript
156
- * // View에서 Table로 relationship definition
156
+ * // Relation definition from View to Table
157
157
  * const UserSummary = View("UserSummary")
158
158
  * .query((db: MyDb) => db.user().select(...))
159
159
  * .relations((r) => ({
160
- * // View → Table (FK 미생성)
160
+ * // View → Table (no FK creation)
161
161
  * company: r.relationKey(["companyId"], () => Company),
162
162
  * }));
163
163
  *
164
- * // Table에서 FK 없이 relationship definition
164
+ * // Relation definition from Table without FK
165
165
  * const Report = Table("Report")
166
166
  * .columns((c) => ({ userId: c.bigint() }))
167
167
  * .relations((r) => ({
@@ -169,18 +169,18 @@ export class ForeignKeyTargetBuilder<
169
169
  * }));
170
170
  * ```
171
171
  *
172
- * @see {@link ForeignKeyBuilder} DB FK Generate 버전
172
+ * @see {@link ForeignKeyBuilder} DB FK creation version
173
173
  */
174
174
  export class RelationKeyBuilder<
175
175
  TOwner extends TableBuilder<any, any> | ViewBuilder<any, any, any>,
176
176
  TTargetFn extends () => TableBuilder<any, any> | ViewBuilder<any, any, any>,
177
177
  > {
178
178
  /**
179
- * @param meta - relationship Metadata
180
- * @param meta.ownerFn - 소유 Table/View factory
181
- * @param meta.columns - relationship column array
182
- * @param meta.targetFn - 참조 Table/View factory
183
- * @param meta.description - relationship description
179
+ * @param meta - Relation Metadata
180
+ * @param meta.ownerFn - Owner Table/View factory
181
+ * @param meta.columns - Relation column name array
182
+ * @param meta.targetFn - Target Table/View factory
183
+ * @param meta.description - Relation description
184
184
  */
185
185
  constructor(
186
186
  readonly meta: {
@@ -192,10 +192,10 @@ export class RelationKeyBuilder<
192
192
  ) {}
193
193
 
194
194
  /**
195
- * relationship set description
195
+ * Set relation description
196
196
  *
197
- * @param desc - relationship description
198
- * @returns RelationKeyBuilder instance
197
+ * @param desc - Relation description
198
+ * @returns New RelationKeyBuilder instance
199
199
  */
200
200
  description(desc: string): RelationKeyBuilder<TOwner, TTargetFn> {
201
201
  return new RelationKeyBuilder({ ...this.meta, description: desc });
@@ -203,36 +203,36 @@ export class RelationKeyBuilder<
203
203
  }
204
204
 
205
205
  /**
206
- * 논리적 relationship 역참조 builder (1:N) - DB FK 미생성
206
+ * Logical relation reverse-reference builder (1:N) - No DB FK creation
207
207
  *
208
- * ForeignKeyTargetBuilder 동일하지만 DB에 FK 제약조건을 생성하지 않음
209
- * View(View)에서도 사용 가능
208
+ * Same as ForeignKeyTargetBuilder but does not create FK constraints in the DB
209
+ * Can also be used in Views
210
210
  *
211
- * @template TTargetTableFn - 참조하는 Table/View builder factory type
212
- * @template TIsSingle - 단일 object 여부
211
+ * @template TTargetTableFn - Referencing Table/View builder factory type
212
+ * @template TIsSingle - Whether it is a single object
213
213
  *
214
214
  * @example
215
215
  * ```typescript
216
216
  * const Company = Table("Company")
217
217
  * .columns((c) => ({ id: c.bigint() }))
218
218
  * .relations((r) => ({
219
- * // 역참조 (FK 미생성)
219
+ * // Reverse-reference (no FK creation)
220
220
  * employees: r.relationKeyTarget(() => UserSummary, "company"),
221
221
  * }));
222
222
  * ```
223
223
  *
224
- * @see {@link ForeignKeyTargetBuilder} DB FK Generate 버전
224
+ * @see {@link ForeignKeyTargetBuilder} DB FK creation version
225
225
  */
226
226
  export class RelationKeyTargetBuilder<
227
227
  TTargetTableFn extends () => TableBuilder<any, any> | ViewBuilder<any, any, any>,
228
228
  TIsSingle extends boolean,
229
229
  > {
230
230
  /**
231
- * @param meta - relationship 역참조 Metadata
232
- * @param meta.targetTableFn - 참조하는 Table/View factory
233
- * @param meta.relationName - 참조하는 Table/View의 관계명
234
- * @param meta.description - relationship description
235
- * @param meta.isSingle - 단일 object 여부
231
+ * @param meta - Relation reverse-reference Metadata
232
+ * @param meta.targetTableFn - Referencing Table/View factory
233
+ * @param meta.relationName - Relation name of the referencing Table/View
234
+ * @param meta.description - Relation description
235
+ * @param meta.isSingle - Whether it is a single object
236
236
  */
237
237
  constructor(
238
238
  readonly meta: {
@@ -244,21 +244,21 @@ export class RelationKeyTargetBuilder<
244
244
  ) {}
245
245
 
246
246
  /**
247
- * relationship set description
247
+ * Set relation description
248
248
  *
249
- * @param desc - relationship description
250
- * @returns RelationKeyTargetBuilder instance
249
+ * @param desc - Relation description
250
+ * @returns New RelationKeyTargetBuilder instance
251
251
  */
252
252
  description(desc: string): RelationKeyTargetBuilder<TTargetTableFn, TIsSingle> {
253
253
  return new RelationKeyTargetBuilder({ ...this.meta, description: desc });
254
254
  }
255
255
 
256
256
  /**
257
- * 단일 object 관계로 설정 (1:1)
257
+ * Set as single object relation (1:1)
258
258
  *
259
- * Basic은 array (1:N), single() 호출 시 단일 object
259
+ * Default is array (1:N), single object when single() is called
260
260
  *
261
- * @returns RelationKeyTargetBuilder instance (isSingle=true)
261
+ * @returns New RelationKeyTargetBuilder instance (isSingle=true)
262
262
  */
263
263
  single(): RelationKeyTargetBuilder<TTargetTableFn, true> {
264
264
  return new RelationKeyTargetBuilder({ ...this.meta, isSingle: true });
@@ -266,9 +266,9 @@ export class RelationKeyTargetBuilder<
266
266
  }
267
267
 
268
268
  /**
269
- * FK relationship factory type (table 전용)
269
+ * FK relation factory type (table only)
270
270
  *
271
- * @template TOwner - 소유 Table builder type
271
+ * @template TOwner - Owner Table builder type
272
272
  * @template TColumnKey - Column key type
273
273
  */
274
274
  type RelationFkFactory<TOwner extends TableBuilder<any, any>, TColumnKey extends string> = {
@@ -277,7 +277,7 @@ type RelationFkFactory<TOwner extends TableBuilder<any, any>, TColumnKey extends
277
277
  columns: TColumnKey[],
278
278
  targetFn: TTargetFn,
279
279
  ): ForeignKeyBuilder<TOwner, TTargetFn>;
280
- /** 1:N FK 역참조 definition */
280
+ /** 1:N FK reverse-reference definition */
281
281
  foreignKeyTarget<TTargetTableFn extends () => TableBuilder<any, any>>(
282
282
  targetTableFn: TTargetTableFn,
283
283
  relationName: string,
@@ -285,21 +285,21 @@ type RelationFkFactory<TOwner extends TableBuilder<any, any>, TColumnKey extends
285
285
  };
286
286
 
287
287
  /**
288
- * 논리적 relationship factory type (table/View 공용)
288
+ * Logical relation factory type (shared for table/View)
289
289
  *
290
- * @template TOwner - 소유 Table/View builder type
290
+ * @template TOwner - Owner Table/View builder type
291
291
  * @template TColumnKey - Column key type
292
292
  */
293
293
  type RelationRkFactory<
294
294
  TOwner extends TableBuilder<any, any> | ViewBuilder<any, any, any>,
295
295
  TColumnKey extends string,
296
296
  > = {
297
- /** N:1 논리적 relationship definition (DB FK 미생성) */
297
+ /** N:1 logical relation definition (no DB FK creation) */
298
298
  relationKey<TTargetFn extends () => TableBuilder<any, any> | ViewBuilder<any, any, any>>(
299
299
  columns: TColumnKey[],
300
300
  targetFn: TTargetFn,
301
301
  ): RelationKeyBuilder<TOwner, TTargetFn>;
302
- /** 1:N 논리적 역참조 definition */
302
+ /** 1:N logical reverse-reference definition */
303
303
  relationKeyTarget<
304
304
  TTargetTableFn extends () => TableBuilder<any, any> | ViewBuilder<any, any, any>,
305
305
  >(
@@ -309,19 +309,19 @@ type RelationRkFactory<
309
309
  };
310
310
 
311
311
  /**
312
- * relationship builder factory Generate
312
+ * Relation builder factory creation
313
313
  *
314
- * TableBuilder.relations() ViewBuilder.relations()used in
315
- * Table FK + RelationKey 모두 사용 가능, View는 RelationKey만 사용 가능
314
+ * Used in TableBuilder.relations() and ViewBuilder.relations()
315
+ * Table can use both FK + RelationKey, View can only use RelationKey
316
316
  *
317
- * @template TOwner - 소유 Table/View builder type
317
+ * @template TOwner - Owner Table/View builder type
318
318
  * @template TColumnKey - Column key type
319
- * @param ownerFn - 소유 Table/View factory function
320
- * @returns relationship builder factory
319
+ * @param ownerFn - Owner Table/View factory function
320
+ * @returns Relation builder factory
321
321
  *
322
322
  * @example
323
323
  * ```typescript
324
- * // Table - FK, RelationKey 모두 사용 가능
324
+ * // Table - both FK and RelationKey available
325
325
  * const Post = Table("Post")
326
326
  * .columns((c) => ({
327
327
  * id: c.bigint(),
@@ -331,11 +331,11 @@ type RelationRkFactory<
331
331
  * author: r.foreignKey(["authorId"], () => User), // FK Generate
332
332
  * }));
333
333
  *
334
- * // View - RelationKey 사용 가능
334
+ * // View - only RelationKey available
335
335
  * const UserSummary = View("UserSummary")
336
336
  * .query(...)
337
337
  * .relations((r) => ({
338
- * posts: r.relationKeyTarget(() => Post, "author"), // FK 미생성
338
+ * posts: r.relationKeyTarget(() => Post, "author"), // No FK creation
339
339
  * }));
340
340
  * ```
341
341
  */
@@ -374,13 +374,13 @@ export function createRelationFactory<
374
374
  }
375
375
 
376
376
  // ============================================
377
- // builder 레코드
377
+ // builder record
378
378
  // ============================================
379
379
 
380
380
  /**
381
381
  * relationship builder record type
382
382
  *
383
- * TableBuilder.relations() ViewBuilder.relations()의 return type
383
+ * Return type of TableBuilder.relations() and ViewBuilder.relations()
384
384
  */
385
385
  export type RelationBuilderRecord = Record<
386
386
  string,
@@ -395,11 +395,11 @@ export type RelationBuilderRecord = Record<
395
395
  // ============================================
396
396
 
397
397
  /**
398
- * FK/RelationKey에서 참조 대상 type 추출 (단일 object)
398
+ * Extract target type from FK/RelationKey (single object)
399
399
  *
400
- * N:1 관계의 참조 대상 type
400
+ * Target type of N:1 relation
401
401
  *
402
- * @template T - FK 또는 RelationKey builder type
402
+ * @template T - FK or RelationKey builder type
403
403
  */
404
404
  export type ExtractRelationTarget<TRelation> = TRelation extends
405
405
  | ForeignKeyBuilder<any, infer TTargetFn>
@@ -412,12 +412,12 @@ export type ExtractRelationTarget<TRelation> = TRelation extends
412
412
  : never;
413
413
 
414
414
  /**
415
- * FKTarget/RelationKeyTarget에서 참조 대상 type 추출 (array 또는 단일 object)
415
+ * Extract target type from FKTarget/RelationKeyTarget (array or single object)
416
416
  *
417
- * 1:N 관계의 참조 대상 type (single() 호출 시 단일 object)
418
- * TTargetTableFn: () => Post 형태로 lazy evaluation하여 순환참조 방지
417
+ * Target type of 1:N relation (single object when single() is called)
418
+ * TTargetTableFn: () => Post form for lazy evaluation to prevent circular references
419
419
  *
420
- * @template T - FKTarget 또는 RelationKeyTarget builder type
420
+ * @template T - FKTarget or RelationKeyTarget builder type
421
421
  */
422
422
  export type ExtractRelationTargetResult<TRelation> = TRelation extends
423
423
  | ForeignKeyTargetBuilder<infer TTargetTableFn, infer TIsSingle>
@@ -434,11 +434,11 @@ export type ExtractRelationTargetResult<TRelation> = TRelation extends
434
434
  : never;
435
435
 
436
436
  /**
437
- * relationship 정의에서 깊은 relationship Type inference
437
+ * Deep relation Type inference from relation definitions
438
438
  *
439
- * 모든 관계를 optional 만들어 include() 없이 access undefined processing
439
+ * Makes all relations optional so accessing without include() results in undefined
440
440
  *
441
- * @template TRelations - relationship builder record type
441
+ * @template TRelations - Relation builder record type
442
442
  *
443
443
  * @example
444
444
  * ```typescript