litedbmodel 1.0.1 → 1.1.0
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.
- package/README.md +17 -13
- package/dist/DBModel.d.ts +18 -18
- package/dist/DBModel.d.ts.map +1 -1
- package/dist/DBModel.js +9 -9
- package/dist/DBModel.js.map +1 -1
- package/dist/LazyRelation.js +7 -7
- package/dist/LazyRelation.js.map +1 -1
- package/dist/SqlFragment.js +1 -1
- package/dist/SqlFragment.js.map +1 -1
- package/dist/decorators.d.ts +6 -7
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +36 -15
- package/dist/decorators.js.map +1 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.d.ts.map +1 -1
- package/docs/COMPARISON.md +4 -2
- package/docs/api/README.md +61 -9
- package/docs/api/classes/Conditions.md +75 -8
- package/docs/api/classes/DBHandler.md +3 -3
- package/docs/api/classes/DBModel.md +260 -106
- package/docs/api/classes/LimitExceededError.md +1 -1
- package/docs/api/classes/Middleware.md +1 -1
- package/docs/api/classes/SqlRaw.md +53 -0
- package/docs/api/classes/SqlRef.md +59 -0
- package/docs/api/classes/Values.md +6 -6
- package/docs/api/classes/WriteInReadOnlyContextError.md +1 -1
- package/docs/api/classes/WriteOutsideTransactionError.md +1 -1
- package/docs/api/functions/belongsTo.md +2 -2
- package/docs/api/functions/closeAllPools.md +1 -1
- package/docs/api/functions/condsToRecord.md +23 -0
- package/docs/api/functions/createMiddleware.md +68 -0
- package/docs/api/functions/createPostgresDriver.md +2 -2
- package/docs/api/functions/createSqliteDriver.md +1 -1
- package/docs/api/functions/dbCast.md +1 -1
- package/docs/api/functions/dbCastIn.md +1 -1
- package/docs/api/functions/dbDynamic.md +1 -1
- package/docs/api/functions/dbFalse.md +1 -1
- package/docs/api/functions/dbImmediate.md +1 -1
- package/docs/api/functions/dbIn.md +1 -1
- package/docs/api/functions/dbNotNull.md +1 -1
- package/docs/api/functions/dbNow.md +1 -1
- package/docs/api/functions/dbNull.md +1 -1
- package/docs/api/functions/dbRaw.md +1 -1
- package/docs/api/functions/dbTrue.md +1 -1
- package/docs/api/functions/dbUuid.md +1 -1
- package/docs/api/functions/dbUuidIn.md +1 -1
- package/docs/api/functions/getDBConfig.md +1 -1
- package/docs/api/functions/getDBHandler.md +1 -1
- package/docs/api/functions/getTransactionConnection.md +2 -2
- package/docs/api/functions/getTransactionContext.md +2 -2
- package/docs/api/functions/hasMany.md +2 -2
- package/docs/api/functions/hasOne.md +2 -2
- package/docs/api/functions/initDBHandler.md +1 -1
- package/docs/api/functions/isAnySqlFragment.md +25 -0
- package/docs/api/functions/isSqlCondition.md +23 -0
- package/docs/api/functions/isSqlFragment.md +23 -0
- package/docs/api/functions/isSqlRaw.md +23 -0
- package/docs/api/functions/isSqlRef.md +23 -0
- package/docs/api/functions/isSqlTypedFragment.md +23 -0
- package/docs/api/functions/model.md +4 -4
- package/docs/api/functions/parentRef.md +1 -1
- package/docs/api/functions/sql.md +182 -0
- package/docs/api/globals.md +71 -19
- package/docs/api/interfaces/Column.md +31 -31
- package/docs/api/interfaces/ColumnOptions.md +4 -4
- package/docs/api/interfaces/CreatedMiddlewareClass.md +110 -0
- package/docs/api/interfaces/DBConfig.md +2 -2
- package/docs/api/interfaces/DBConfigOptions.md +1 -1
- package/docs/api/interfaces/DeleteOptions.md +1 -1
- package/docs/api/interfaces/InsertOptions.md +2 -2
- package/docs/api/interfaces/LimitConfig.md +1 -1
- package/docs/api/interfaces/MiddlewareConfig.md +40 -0
- package/docs/api/interfaces/ModelOptions.md +1 -1
- package/docs/api/interfaces/PkeyResult.md +1 -1
- package/docs/api/interfaces/SelectOptions.md +1 -1
- package/docs/api/interfaces/SqlCondition.md +27 -0
- package/docs/api/interfaces/SqlFragment.md +20 -0
- package/docs/api/interfaces/SqlTypedFragment.md +29 -0
- package/docs/api/interfaces/TransactionOptions.md +1 -1
- package/docs/api/interfaces/UpdateManyOptions.md +1 -1
- package/docs/api/interfaces/UpdateOptions.md +1 -1
- package/docs/sql-tagged-template.md +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
[**litedbmodel v1.0.1**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[litedbmodel](../globals.md) / CreatedMiddlewareClass
|
|
6
|
+
|
|
7
|
+
# Interface: CreatedMiddlewareClass\<S\>
|
|
8
|
+
|
|
9
|
+
Defined in: Middleware.ts:427
|
|
10
|
+
|
|
11
|
+
Type for the middleware class created by createMiddleware.
|
|
12
|
+
Provides typed access to state via getCurrentContext().
|
|
13
|
+
|
|
14
|
+
## Type Parameters
|
|
15
|
+
|
|
16
|
+
| Type Parameter | Description |
|
|
17
|
+
| ------ | ------ |
|
|
18
|
+
| `S` *extends* `object` | The state object type |
|
|
19
|
+
|
|
20
|
+
## Constructors
|
|
21
|
+
|
|
22
|
+
### Constructor
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
new CreatedMiddlewareClass(): Middleware & S;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Defined in: Middleware.ts:437
|
|
29
|
+
|
|
30
|
+
Constructor
|
|
31
|
+
|
|
32
|
+
#### Returns
|
|
33
|
+
|
|
34
|
+
[`Middleware`](../classes/Middleware.md) & `S`
|
|
35
|
+
|
|
36
|
+
## Methods
|
|
37
|
+
|
|
38
|
+
### getCurrentContext()
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
getCurrentContext(): S;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Defined in: Middleware.ts:429
|
|
45
|
+
|
|
46
|
+
Get the current request's state (creates new instance if none exists)
|
|
47
|
+
|
|
48
|
+
#### Returns
|
|
49
|
+
|
|
50
|
+
`S`
|
|
51
|
+
|
|
52
|
+
***
|
|
53
|
+
|
|
54
|
+
### run()
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
run<R>(fn: () => R): R;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Defined in: Middleware.ts:431
|
|
61
|
+
|
|
62
|
+
Run a function with a fresh middleware context
|
|
63
|
+
|
|
64
|
+
#### Type Parameters
|
|
65
|
+
|
|
66
|
+
| Type Parameter |
|
|
67
|
+
| ------ |
|
|
68
|
+
| `R` |
|
|
69
|
+
|
|
70
|
+
#### Parameters
|
|
71
|
+
|
|
72
|
+
| Parameter | Type |
|
|
73
|
+
| ------ | ------ |
|
|
74
|
+
| `fn` | () => `R` |
|
|
75
|
+
|
|
76
|
+
#### Returns
|
|
77
|
+
|
|
78
|
+
`R`
|
|
79
|
+
|
|
80
|
+
***
|
|
81
|
+
|
|
82
|
+
### hasContext()
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
hasContext(): boolean;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Defined in: Middleware.ts:433
|
|
89
|
+
|
|
90
|
+
Check if a context exists for the current request
|
|
91
|
+
|
|
92
|
+
#### Returns
|
|
93
|
+
|
|
94
|
+
`boolean`
|
|
95
|
+
|
|
96
|
+
***
|
|
97
|
+
|
|
98
|
+
### clearContext()
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
clearContext(): void;
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Defined in: Middleware.ts:435
|
|
105
|
+
|
|
106
|
+
Clear the current context (useful for testing)
|
|
107
|
+
|
|
108
|
+
#### Returns
|
|
109
|
+
|
|
110
|
+
`void`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**litedbmodel
|
|
1
|
+
[**litedbmodel v1.0.1**](../README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -22,4 +22,4 @@ Database configuration
|
|
|
22
22
|
| <a id="max"></a> `max?` | `number` | Maximum pool size | DBHandler.ts:52 |
|
|
23
23
|
| <a id="timeout"></a> `timeout?` | `number` | Connection timeout in seconds | DBHandler.ts:54 |
|
|
24
24
|
| <a id="querytimeout"></a> `queryTimeout?` | `number` | Query timeout in seconds | DBHandler.ts:56 |
|
|
25
|
-
| <a id="driver"></a> `driver?` | `"postgres"` \| `"
|
|
25
|
+
| <a id="driver"></a> `driver?` | `"postgres"` \| `"mysql"` \| `"sqlite"` | Driver type: 'postgres' (default), 'sqlite', or 'mysql' | DBHandler.ts:58 |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**litedbmodel
|
|
1
|
+
[**litedbmodel v1.0.1**](../README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -24,5 +24,5 @@ Insert options with type-safe column references.
|
|
|
24
24
|
| <a id="returning"></a> `returning?` | `boolean` | If true, return PkeyResult with affected primary keys. If false (default), return null for better performance. | types.ts:157 |
|
|
25
25
|
| <a id="conflict"></a> ~~`conflict?`~~ | `string` | **Deprecated** Use onConflict instead | types.ts:159 |
|
|
26
26
|
| <a id="onconflict"></a> `onConflict?` | \| [`Column`](Column.md)\<`unknown`, `Model`\> \| [`Column`](Column.md)\<`unknown`, `Model`\>[] | Columns for ON CONFLICT clause (unique constraint columns). Must be Column symbols from the same model for type safety. **Example** `// Single column onConflict: User.email // Multiple columns (composite unique constraint) onConflict: [UserPref.user_id, UserPref.key]` | types.ts:169 |
|
|
27
|
-
| <a id="onconflictupdate"></a> `onConflictUpdate?` | [`Column`](Column.md)\<`unknown`, `Model`\>[]
|
|
27
|
+
| <a id="onconflictupdate"></a> `onConflictUpdate?` | `"all"` \| [`Column`](Column.md)\<`unknown`, `Model`\>[] | Columns to update on conflict. Can be: - 'all': Update all inserted columns - Array of Column symbols from the same model **Example** `// Update all columns onConflictUpdate: 'all' // Update specific columns onConflictUpdate: [User.name, User.updated_at]` | types.ts:181 |
|
|
28
28
|
| <a id="onconflictignore"></a> `onConflictIgnore?` | `boolean` | If true, ignore the insert on conflict (DO NOTHING). Cannot be used with onConflictUpdate. | types.ts:186 |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[**litedbmodel v1.0.1**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[litedbmodel](../globals.md) / MiddlewareConfig
|
|
6
|
+
|
|
7
|
+
# Interface: MiddlewareConfig\<S\>
|
|
8
|
+
|
|
9
|
+
Defined in: Middleware.ts:311
|
|
10
|
+
|
|
11
|
+
Configuration object for createMiddleware.
|
|
12
|
+
All hook functions receive `this` bound to the state object.
|
|
13
|
+
|
|
14
|
+
Hook signature matches the Middleware class:
|
|
15
|
+
- Method-level hooks: `(model, next, ...args)`
|
|
16
|
+
- execute hook: `(next, sql, params)`
|
|
17
|
+
|
|
18
|
+
## Type Parameters
|
|
19
|
+
|
|
20
|
+
| Type Parameter | Default type | Description |
|
|
21
|
+
| ------ | ------ | ------ |
|
|
22
|
+
| `S` *extends* `object` | `Record`\<`string`, `never`\> | Type of the state object (defaults to empty object) |
|
|
23
|
+
|
|
24
|
+
## Properties
|
|
25
|
+
|
|
26
|
+
| Property | Type | Description | Defined in |
|
|
27
|
+
| ------ | ------ | ------ | ------ |
|
|
28
|
+
| <a id="state"></a> `state?` | `S` | Initial state for each request context. A fresh copy is created for each request via structuredClone. Access via `this` in hook functions or `getCurrentContext()`. | Middleware.ts:317 |
|
|
29
|
+
| <a id="init"></a> `init?` | (`this`: `S`) => `void` | Called when a new context is created | Middleware.ts:320 |
|
|
30
|
+
| <a id="find"></a> `find?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextFind`\<`T`\>, `conditions`: `Conds`, `options?`: [`SelectOptions`](SelectOptions.md)) => `Promise`\<`InstanceType`\<`T`\>[]\> | Intercept find() | Middleware.ts:323 |
|
|
31
|
+
| <a id="findone"></a> `findOne?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextFindOne`\<`T`\>, `conditions`: `Conds`, `options?`: [`SelectOptions`](SelectOptions.md)) => `Promise`\<`InstanceType`\<`T`\> \| `null`\> | Intercept findOne() | Middleware.ts:332 |
|
|
32
|
+
| <a id="findbyid"></a> `findById?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextFindById`\<`T`\>, `id`: `unknown`, `options?`: [`SelectOptions`](SelectOptions.md)) => `Promise`\<`InstanceType`\<`T`\>[]\> | Intercept findById() | Middleware.ts:341 |
|
|
33
|
+
| <a id="count"></a> `count?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextCount`, `conditions`: `Conds`) => `Promise`\<`number`\> | Intercept count() | Middleware.ts:350 |
|
|
34
|
+
| <a id="create"></a> `create?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextCreate`, `pairs`: readonly readonly \[[`Column`](Column.md)\<`any`, `any`\>, `any`\][], `options?`: [`InsertOptions`](InsertOptions.md)\<`unknown`\>) => `Promise`\<[`PkeyResult`](PkeyResult.md) \| `null`\> | Intercept create() | Middleware.ts:358 |
|
|
35
|
+
| <a id="createmany"></a> `createMany?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextCreateMany`, `pairsArray`: readonly readonly readonly \[[`Column`](Column.md)\<`any`, `any`\>, `any`\][][], `options?`: [`InsertOptions`](InsertOptions.md)\<`unknown`\>) => `Promise`\<[`PkeyResult`](PkeyResult.md) \| `null`\> | Intercept createMany() | Middleware.ts:367 |
|
|
36
|
+
| <a id="update"></a> `update?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextUpdate`, `conditions`: `Conds`, `values`: readonly readonly \[[`Column`](Column.md)\<`any`, `any`\>, `any`\][], `options?`: [`UpdateOptions`](UpdateOptions.md)) => `Promise`\<[`PkeyResult`](PkeyResult.md) \| `null`\> | Intercept update() | Middleware.ts:376 |
|
|
37
|
+
| <a id="updatemany"></a> `updateMany?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextUpdateMany`, `records`: readonly readonly readonly \[[`Column`](Column.md)\<`any`, `any`\>, `any`\][][], `options?`: [`UpdateManyOptions`](UpdateManyOptions.md)) => `Promise`\<[`PkeyResult`](PkeyResult.md) \| `null`\> | Intercept updateMany() | Middleware.ts:386 |
|
|
38
|
+
| <a id="delete"></a> `delete?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextDelete`, `conditions`: `Conds`, `options?`: [`DeleteOptions`](DeleteOptions.md)) => `Promise`\<[`PkeyResult`](PkeyResult.md) \| `null`\> | Intercept delete() | Middleware.ts:395 |
|
|
39
|
+
| <a id="execute"></a> `execute?` | (`this`: `S`, `next`: `NextExecute`, `sql`: `string`, `params?`: `unknown`[]) => `Promise`\<`ExecuteResult`\> | Intercept execute() - lowest level, catches ALL SQL queries | Middleware.ts:404 |
|
|
40
|
+
| <a id="query"></a> `query?` | \<`T`\>(`this`: `S`, `model`: `T`, `next`: `NextQuery`\<`T`\>, `sql`: `string`, `params?`: `unknown`[]) => `Promise`\<`InstanceType`\<`T`\>[]\> | Intercept query() - catches raw SQL that returns model instances | Middleware.ts:412 |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**litedbmodel v1.0.1**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[litedbmodel](../globals.md) / SqlCondition
|
|
6
|
+
|
|
7
|
+
# Interface: SqlCondition\<M\>
|
|
8
|
+
|
|
9
|
+
Defined in: SqlFragment.ts:48
|
|
10
|
+
|
|
11
|
+
A SQL condition with embedded parameter values.
|
|
12
|
+
Used for Pattern B (value-embedded) conditions and value-free conditions (IS NULL).
|
|
13
|
+
|
|
14
|
+
## Type Parameters
|
|
15
|
+
|
|
16
|
+
| Type Parameter | Default type | Description |
|
|
17
|
+
| ------ | ------ | ------ |
|
|
18
|
+
| `M` | `unknown` | The model type the Column belongs to |
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
| Property | Modifier | Type | Defined in |
|
|
23
|
+
| ------ | ------ | ------ | ------ |
|
|
24
|
+
| <a id="_tag"></a> `_tag` | `readonly` | `"SqlCondition"` | SqlFragment.ts:49 |
|
|
25
|
+
| <a id="sql"></a> `sql` | `readonly` | `string` | SqlFragment.ts:50 |
|
|
26
|
+
| <a id="params"></a> `params` | `readonly` | readonly `unknown`[] | SqlFragment.ts:51 |
|
|
27
|
+
| <a id="__modeltype"></a> `__modelType?` | `readonly` | `M` | SqlFragment.ts:52 |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[**litedbmodel v1.0.1**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[litedbmodel](../globals.md) / SqlFragment
|
|
6
|
+
|
|
7
|
+
# Interface: SqlFragment
|
|
8
|
+
|
|
9
|
+
Defined in: SqlFragment.ts:21
|
|
10
|
+
|
|
11
|
+
A general SQL fragment with parameterized values.
|
|
12
|
+
Used for withQuery, QUERY, and execute.
|
|
13
|
+
|
|
14
|
+
## Properties
|
|
15
|
+
|
|
16
|
+
| Property | Modifier | Type | Defined in |
|
|
17
|
+
| ------ | ------ | ------ | ------ |
|
|
18
|
+
| <a id="_tag"></a> `_tag` | `readonly` | `"SqlFragment"` | SqlFragment.ts:22 |
|
|
19
|
+
| <a id="sql"></a> `sql` | `readonly` | `string` | SqlFragment.ts:23 |
|
|
20
|
+
| <a id="params"></a> `params` | `readonly` | readonly `unknown`[] | SqlFragment.ts:24 |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[**litedbmodel v1.0.1**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[litedbmodel](../globals.md) / SqlTypedFragment
|
|
6
|
+
|
|
7
|
+
# Interface: SqlTypedFragment\<V, M\>
|
|
8
|
+
|
|
9
|
+
Defined in: SqlFragment.ts:34
|
|
10
|
+
|
|
11
|
+
A typed SQL fragment that preserves the Column's value type.
|
|
12
|
+
Used as the first element of a condition tuple (Pattern A).
|
|
13
|
+
|
|
14
|
+
## Type Parameters
|
|
15
|
+
|
|
16
|
+
| Type Parameter | Default type | Description |
|
|
17
|
+
| ------ | ------ | ------ |
|
|
18
|
+
| `V` | `unknown` | The value type of the referenced Column |
|
|
19
|
+
| `M` | `unknown` | The model type the Column belongs to |
|
|
20
|
+
|
|
21
|
+
## Properties
|
|
22
|
+
|
|
23
|
+
| Property | Modifier | Type | Defined in |
|
|
24
|
+
| ------ | ------ | ------ | ------ |
|
|
25
|
+
| <a id="_tag"></a> `_tag` | `readonly` | `"SqlTypedFragment"` | SqlFragment.ts:35 |
|
|
26
|
+
| <a id="sql"></a> `sql` | `readonly` | `string` | SqlFragment.ts:36 |
|
|
27
|
+
| <a id="params"></a> `params` | `readonly` | readonly `unknown`[] | SqlFragment.ts:37 |
|
|
28
|
+
| <a id="__valuetype"></a> `__valueType?` | `readonly` | `V` | SqlFragment.ts:38 |
|
|
29
|
+
| <a id="__modeltype"></a> `__modelType?` | `readonly` | `M` | SqlFragment.ts:39 |
|
|
@@ -139,14 +139,14 @@ class UserActivityModel extends DBModel {
|
|
|
139
139
|
${User.id} AS user_id,
|
|
140
140
|
${User.name} AS user_name,
|
|
141
141
|
COUNT(${Post.id}) AS total_posts
|
|
142
|
-
FROM ${User
|
|
143
|
-
LEFT JOIN ${Post
|
|
142
|
+
FROM ${User}
|
|
143
|
+
LEFT JOIN ${Post} ON ${User.id} = ${Post.user_id}
|
|
144
144
|
GROUP BY ${User.id}, ${User.name}
|
|
145
145
|
`;
|
|
146
146
|
}
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
When only Column references and
|
|
149
|
+
When only Column references and Model classes are interpolated (no runtime values), the `sql` tag embeds them directly in the SQL string with no parameters.
|
|
150
150
|
|
|
151
151
|
String `QUERY` is still supported for backward compatibility.
|
|
152
152
|
|
|
@@ -175,7 +175,7 @@ The `sql` tag processes interpolated values according to their type:
|
|
|
175
175
|
| Interpolated Value | Processing | Example Output |
|
|
176
176
|
|---|---|---|
|
|
177
177
|
| `Column` | Embedded as column name | `age`, `name` |
|
|
178
|
-
| `{ TABLE_NAME }` | Embedded as table name | `users`, `posts` |
|
|
178
|
+
| Model class (`{ TABLE_NAME }`) | Embedded as table name | `users`, `posts` |
|
|
179
179
|
| `sql.raw(str)` | Embedded as raw SQL (no parameterization) | `ASC`, `DISTINCT` |
|
|
180
180
|
| `sql.ref(col)` | Embedded as `table.column` | `users.id` |
|
|
181
181
|
| `parentRef(col)` | Embedded as `table.column` | `users.id` |
|
|
@@ -235,7 +235,7 @@ The `sql` tag returns different types based on the interpolated values, enabling
|
|
|
235
235
|
|---|---|---|
|
|
236
236
|
| Single `Column` only | `SqlTypedFragment<V, M>` | Condition tuple first element, or value-free condition (IS NULL) |
|
|
237
237
|
| Single `Column` + value(s) | `SqlCondition<M>` | Direct condition element (Pattern B) |
|
|
238
|
-
| Multiple Columns /
|
|
238
|
+
| Multiple Columns / Model classes | `SqlFragment` | `QUERY`, `withQuery`, `execute` |
|
|
239
239
|
| Mixed (Columns + values) | `SqlFragment` | `withQuery`, `execute` |
|
|
240
240
|
|
|
241
241
|
- `SqlTypedFragment<V, M>` carries the Column's value type `V` and model type `M`, enabling type checking on the tuple's second element.
|