litedbmodel 2.2.3 → 2.2.5

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 (91) hide show
  1. package/dist/index.cjs +6 -41
  2. package/dist/scp/index.cjs +7 -42
  3. package/dist/scp/index.d.ts +1 -1
  4. package/dist/scp/index.d.ts.map +1 -1
  5. package/dist/scp/index.js.map +1 -1
  6. package/dist/scp/index.mjs +7 -42
  7. package/dist/scp/makesql/index.d.ts +1 -1
  8. package/dist/scp/makesql/index.d.ts.map +1 -1
  9. package/dist/scp/makesql/index.js.map +1 -1
  10. package/dist/scp/makesql/tx.d.ts +20 -24
  11. package/dist/scp/makesql/tx.d.ts.map +1 -1
  12. package/dist/scp/makesql/tx.js +24 -53
  13. package/dist/scp/makesql/tx.js.map +1 -1
  14. package/dist/scp/makesql/writeouttype.d.ts +5 -7
  15. package/dist/scp/makesql/writeouttype.d.ts.map +1 -1
  16. package/dist/scp/makesql/writeouttype.js +13 -19
  17. package/dist/scp/makesql/writeouttype.js.map +1 -1
  18. package/dist/scp/write-bundle.js +1 -1
  19. package/dist/scp/write-bundle.js.map +1 -1
  20. package/docs/BENCHMARK.md +26 -22
  21. package/docs/COMPARISON.md +8 -4
  22. package/docs/api/README.md +1 -1
  23. package/docs/api/classes/Conditions.md +10 -10
  24. package/docs/api/classes/DBHandler.md +17 -17
  25. package/docs/api/classes/DBModel.md +111 -104
  26. package/docs/api/classes/LimitExceededError.md +8 -8
  27. package/docs/api/classes/Middleware.md +18 -18
  28. package/docs/api/classes/SqlRaw.md +6 -6
  29. package/docs/api/classes/SqlRef.md +7 -7
  30. package/docs/api/classes/Values.md +6 -6
  31. package/docs/api/classes/WriteInReadOnlyContextError.md +5 -5
  32. package/docs/api/classes/WriteOutsideTransactionError.md +5 -5
  33. package/docs/api/functions/belongsTo.md +2 -2
  34. package/docs/api/functions/closeAllPools.md +2 -2
  35. package/docs/api/functions/condsToRecord.md +2 -2
  36. package/docs/api/functions/createMiddleware.md +2 -2
  37. package/docs/api/functions/createPostgresDriver.md +2 -2
  38. package/docs/api/functions/createSqliteDriver.md +2 -2
  39. package/docs/api/functions/dbCast.md +3 -3
  40. package/docs/api/functions/dbCastIn.md +2 -2
  41. package/docs/api/functions/dbDynamic.md +3 -3
  42. package/docs/api/functions/dbFalse.md +2 -2
  43. package/docs/api/functions/dbImmediate.md +2 -2
  44. package/docs/api/functions/dbIn.md +2 -2
  45. package/docs/api/functions/dbNotNull.md +2 -2
  46. package/docs/api/functions/dbNow.md +2 -2
  47. package/docs/api/functions/dbNull.md +2 -2
  48. package/docs/api/functions/dbRaw.md +2 -2
  49. package/docs/api/functions/dbTrue.md +2 -2
  50. package/docs/api/functions/dbUuid.md +3 -3
  51. package/docs/api/functions/dbUuidIn.md +2 -2
  52. package/docs/api/functions/formatLocalDate.md +25 -0
  53. package/docs/api/functions/formatUTCDate.md +25 -0
  54. package/docs/api/functions/getDBConfig.md +2 -2
  55. package/docs/api/functions/getDBHandler.md +2 -2
  56. package/docs/api/functions/getTransactionConnection.md +2 -2
  57. package/docs/api/functions/getTransactionContext.md +2 -2
  58. package/docs/api/functions/hasMany.md +2 -2
  59. package/docs/api/functions/hasOne.md +2 -2
  60. package/docs/api/functions/initDBHandler.md +2 -2
  61. package/docs/api/functions/isAnySqlFragment.md +2 -2
  62. package/docs/api/functions/isConnectionError.md +26 -0
  63. package/docs/api/functions/isSqlCondition.md +2 -2
  64. package/docs/api/functions/isSqlFragment.md +2 -2
  65. package/docs/api/functions/isSqlRaw.md +2 -2
  66. package/docs/api/functions/isSqlRef.md +2 -2
  67. package/docs/api/functions/isSqlTypedFragment.md +2 -2
  68. package/docs/api/functions/model.md +6 -42
  69. package/docs/api/functions/parentRef.md +2 -2
  70. package/docs/api/functions/sql.md +7 -7
  71. package/docs/api/globals.md +57 -22
  72. package/docs/api/interfaces/Column.md +31 -31
  73. package/docs/api/interfaces/ColumnOptions.md +5 -4
  74. package/docs/api/interfaces/CreatedMiddlewareClass.md +7 -7
  75. package/docs/api/interfaces/DBConfig.md +13 -11
  76. package/docs/api/interfaces/DBConfigOptions.md +8 -8
  77. package/docs/api/interfaces/DeleteOptions.md +4 -4
  78. package/docs/api/interfaces/InsertOptions.md +8 -8
  79. package/docs/api/interfaces/LimitConfig.md +4 -4
  80. package/docs/api/interfaces/MiddlewareConfig.md +15 -15
  81. package/docs/api/interfaces/ModelOptions.md +8 -7
  82. package/docs/api/interfaces/PkeyResult.md +4 -4
  83. package/docs/api/interfaces/SelectOptions.md +17 -16
  84. package/docs/api/interfaces/SqlCondition.md +6 -6
  85. package/docs/api/interfaces/SqlFragment.md +5 -5
  86. package/docs/api/interfaces/SqlTypedFragment.md +7 -7
  87. package/docs/api/interfaces/TransactionOptions.md +7 -7
  88. package/docs/api/interfaces/UpdateManyOptions.md +4 -4
  89. package/docs/api/interfaces/UpdateOptions.md +4 -4
  90. package/docs/benchmark-chart.svg +225 -249
  91. package/package.json +8 -4
@@ -1,4 +1,4 @@
1
- [**litedbmodel v1.0.1**](../README.md)
1
+ [**litedbmodel v2.2.5**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Abstract Class: DBModel
8
8
 
9
- Defined in: DBModel.ts:113
9
+ Defined in: [DBModel.ts:139](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L139)
10
10
 
11
11
  Base class for all database models in litedbmodel.
12
12
  Provides CRUD operations, relations, transactions, and middleware support.
@@ -63,7 +63,7 @@ const john = await User.findOne([[User.email, 'john@example.com']]);
63
63
  new DBModel(): DBModel;
64
64
  ```
65
65
 
66
- Defined in: DBModel.ts:1583
66
+ Defined in: [DBModel.ts:1866](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1866)
67
67
 
68
68
  #### Returns
69
69
 
@@ -73,28 +73,19 @@ Defined in: DBModel.ts:1583
73
73
 
74
74
  | Property | Modifier | Type | Default value | Description | Defined in |
75
75
  | ------ | ------ | ------ | ------ | ------ | ------ |
76
- | <a id="table_name"></a> `TABLE_NAME` | `static` | `string` | `''` | Table name | DBModel.ts:119 |
77
- | <a id="update_table_name"></a> `UPDATE_TABLE_NAME` | `static` | `string` \| `null` | `null` | Table name for UPDATE/DELETE (if different from TABLE_NAME) | DBModel.ts:144 |
78
- | <a id="select_column"></a> `SELECT_COLUMN` | `static` | `string` | `'*'` | Default SELECT columns | DBModel.ts:147 |
79
- | <a id="default_order"></a> `DEFAULT_ORDER` | `static` | `OrderSpec` \| `null` | `null` | Default ORDER BY clause (type-safe OrderColumn or OrderColumn[]) | DBModel.ts:150 |
80
- | <a id="default_group"></a> `DEFAULT_GROUP` | `static` | \| `string` \| [`Column`](../interfaces/Column.md)\<`unknown`, `unknown`\> \| [`Column`](../interfaces/Column.md)\<`unknown`, `unknown`\>[] \| `null` | `null` | Default GROUP BY clause (Column, Column[], or raw string) | DBModel.ts:153 |
81
- | <a id="find_filter"></a> `FIND_FILTER` | `static` | `Conds` \| `null` | `null` | Default filter conditions applied to all queries (use tuple format like find()) | DBModel.ts:156 |
82
- | <a id="query"></a> `QUERY` | `static` | \| `string` \| [`SqlFragment`](../interfaces/SqlFragment.md) \| [`SqlTypedFragment`](../interfaces/SqlTypedFragment.md)\<`unknown`, `unknown`\> \| [`SqlCondition`](../interfaces/SqlCondition.md)\<`unknown`\> \| `null` | `null` | SQL query for query-based models (view models, aggregations, etc.) When defined, the model uses this query as a CTE instead of TABLE_NAME. **Example** `// Static query static QUERY = ` SELECT users.id, COUNT(posts.id) as post_count FROM users LEFT JOIN posts ON users.id = posts.user_id GROUP BY users.id `;` | DBModel.ts:172 |
83
- | <a id="pkey_columns"></a> `PKEY_COLUMNS` | `static` | [`Column`](../interfaces/Column.md)\<`unknown`, `unknown`\>[] \| `null` | `null` | Primary key columns (use getter to reference Model.column) | DBModel.ts:181 |
84
- | <a id="seq_name"></a> `SEQ_NAME` | `static` | `string` \| `null` | `null` | Sequence name for auto-increment (use getter if needed) | DBModel.ts:184 |
85
- | <a id="id_type"></a> `ID_TYPE` | `static` | `"uuid"` \| `"serial"` \| `null` | `null` | ID type: 'serial' for auto-increment, 'uuid' for UUID generation | DBModel.ts:187 |
86
- | <a id="_dbconfig"></a> `_dbConfig` | `static` | [`DBConfig`](../interfaces/DBConfig.md) \| `null` | `null` | Database config | DBModel.ts:194 |
87
- | <a id="_limitconfig"></a> `_limitConfig` | `static` | [`LimitConfig`](../interfaces/LimitConfig.md) | `{}` | Limit config for safety guards | DBModel.ts:197 |
88
- | <a id="_configoptions"></a> `_configOptions` | `static` | [`DBConfigOptions`](../interfaces/DBConfigOptions.md) | `undefined` | Configuration options for reader/writer separation | DBModel.ts:200 |
89
- | <a id="_lasttransactiontime"></a> `_lastTransactionTime` | `static` | `number` | `0` | Last transaction completion time (for writer sticky) | DBModel.ts:206 |
90
- | <a id="true"></a> `true` | `readonly` | `DBBoolValue` | `undefined` | Boolean TRUE value | DBModel.ts:1150 |
91
- | <a id="false"></a> `false` | `readonly` | `DBBoolValue` | `undefined` | Boolean FALSE value | DBModel.ts:1153 |
92
- | <a id="null"></a> `null` | `readonly` | `DBNullValue` | `undefined` | NULL value | DBModel.ts:1156 |
93
- | <a id="notnull"></a> `notNull` | `readonly` | `DBNotNullValue` | `undefined` | NOT NULL value | DBModel.ts:1159 |
94
- | <a id="now"></a> `now` | `readonly` | `DBImmediateValue` | `undefined` | NOW() value | DBModel.ts:1162 |
95
- | <a id="_modelclass"></a> `_modelClass` | `protected` | *typeof* `DBModel` | `undefined` | Instance reference to the static class | DBModel.ts:1572 |
96
- | <a id="_relationcache"></a> `_relationCache` | `protected` | `Map`\<`string`, `unknown`\> \| `null` | `null` | Per-instance cache for loaded relations (lazy-initialized) | DBModel.ts:1575 |
97
- | <a id="_deferredcontext"></a> `_deferredContext` | `public` | \[*typeof* `DBModel`, `DBModel`[]\] \| `null` | `null` | Deferred context info: [sourceClass, records] set by _select, resolved on first relation access | DBModel.ts:1581 |
76
+ | <a id="query"></a> `QUERY` | `static` | \| `string` \| [`SqlFragment`](../interfaces/SqlFragment.md) \| [`SqlTypedFragment`](../interfaces/SqlTypedFragment.md)\<`unknown`, `unknown`\> \| [`SqlCondition`](../interfaces/SqlCondition.md)\<`unknown`\> \| `null` | `null` | SQL query for query-based models (view models, aggregations, etc.) When defined, the model uses this query as a CTE instead of TABLE_NAME. **Example** `// Static query static QUERY = ` SELECT users.id, COUNT(posts.id) as post_count FROM users LEFT JOIN posts ON users.id = posts.user_id GROUP BY users.id `;` | [DBModel.ts:198](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L198) |
77
+ | <a id="_dbconfig"></a> `_dbConfig` | `static` | [`DBConfig`](../interfaces/DBConfig.md) \| `null` | `null` | Database config | [DBModel.ts:220](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L220) |
78
+ | <a id="_limitconfig"></a> `_limitConfig` | `static` | [`LimitConfig`](../interfaces/LimitConfig.md) | `{}` | Limit config for safety guards | [DBModel.ts:223](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L223) |
79
+ | <a id="_configoptions"></a> `_configOptions` | `static` | [`DBConfigOptions`](../interfaces/DBConfigOptions.md) | `undefined` | Configuration options for reader/writer separation | [DBModel.ts:226](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L226) |
80
+ | <a id="_lasttransactiontime"></a> `_lastTransactionTime` | `static` | `number` | `0` | Last transaction completion time (for writer sticky) | [DBModel.ts:232](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L232) |
81
+ | <a id="true"></a> `true` | `readonly` | `DBBoolValue` | `undefined` | Boolean TRUE value | [DBModel.ts:1441](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1441) |
82
+ | <a id="false"></a> `false` | `readonly` | `DBBoolValue` | `undefined` | Boolean FALSE value | [DBModel.ts:1444](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1444) |
83
+ | <a id="null"></a> `null` | `readonly` | `DBNullValue` | `undefined` | NULL value | [DBModel.ts:1447](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1447) |
84
+ | <a id="notnull"></a> `notNull` | `readonly` | `DBNotNullValue` | `undefined` | NOT NULL value | [DBModel.ts:1450](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1450) |
85
+ | <a id="now"></a> `now` | `readonly` | `DBImmediateValue` | `undefined` | NOW() value | [DBModel.ts:1453](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1453) |
86
+ | <a id="_modelclass"></a> `_modelClass` | `protected` | *typeof* `DBModel` | `undefined` | Instance reference to the static class | [DBModel.ts:1855](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1855) |
87
+ | <a id="_relationcache"></a> `_relationCache` | `protected` | `Map`\<`string`, `unknown`\> \| `null` | `null` | Per-instance cache for loaded relations (lazy-initialized) | [DBModel.ts:1858](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1858) |
88
+ | <a id="_deferredcontext"></a> `_deferredContext` | `public` | \[*typeof* `DBModel`, `DBModel`[]\] \| `null` | `null` | Deferred context info: [sourceClass, records] set by _select, resolved on first relation access | [DBModel.ts:1864](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1864) |
98
89
 
99
90
  ## Methods
100
91
 
@@ -104,7 +95,7 @@ Defined in: DBModel.ts:1583
104
95
  static asModel<T>(this: T): T & ColumnsOf<InstanceType<T>>;
105
96
  ```
106
97
 
107
- Defined in: DBModel.ts:139
98
+ Defined in: [DBModel.ts:165](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L165)
108
99
 
109
100
  Returns the model class with type-safe column properties.
110
101
  Use this instead of manual casting with `ColumnsOf`.
@@ -148,7 +139,7 @@ await User.find([[User.name, 'John']]);
148
139
  static setConfig(config: DBConfig, options?: DBConfigOptions): void;
149
140
  ```
150
141
 
151
- Defined in: DBModel.ts:236
142
+ Defined in: [DBModel.ts:392](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L392)
152
143
 
153
144
  Initialize DBModel with database config.
154
145
  Call this once at application startup.
@@ -197,7 +188,7 @@ DBModel.setConfig(
197
188
  static getLimitConfig(): LimitConfig;
198
189
  ```
199
190
 
200
- Defined in: DBModel.ts:260
191
+ Defined in: [DBModel.ts:421](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L421)
201
192
 
202
193
  Get current limit configuration.
203
194
 
@@ -213,7 +204,7 @@ Get current limit configuration.
213
204
  static setLimitConfig(config: LimitConfig): void;
214
205
  ```
215
206
 
216
- Defined in: DBModel.ts:275
207
+ Defined in: [DBModel.ts:436](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L436)
217
208
 
218
209
  Update limit configuration.
219
210
 
@@ -245,7 +236,7 @@ DBModel.setLimitConfig({ findHardLimit: null, hasManyHardLimit: null });
245
236
  static getDBConfig(): DBConfig | null;
246
237
  ```
247
238
 
248
- Defined in: DBModel.ts:282
239
+ Defined in: [DBModel.ts:443](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L443)
249
240
 
250
241
  Get database config
251
242
 
@@ -261,7 +252,7 @@ Get database config
261
252
  static getDriverType(): "postgres" | "mysql" | "sqlite";
262
253
  ```
263
254
 
264
- Defined in: DBModel.ts:290
255
+ Defined in: [DBModel.ts:451](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L451)
265
256
 
266
257
  Get the database driver type.
267
258
  Returns 'postgres', 'mysql', or 'sqlite'.
@@ -278,7 +269,7 @@ Returns 'postgres', 'mysql', or 'sqlite'.
278
269
  protected static getHandler(): DBHandler;
279
270
  ```
280
271
 
281
- Defined in: DBModel.ts:316
272
+ Defined in: [DBModel.ts:477](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L477)
282
273
 
283
274
  Get a DBHandler instance for this model.
284
275
  Connection priority:
@@ -299,7 +290,7 @@ Connection priority:
299
290
  protected static _shouldUseWriterSticky(): boolean;
300
291
  ```
301
292
 
302
- Defined in: DBModel.ts:345
293
+ Defined in: [DBModel.ts:506](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L506)
303
294
 
304
295
  Check if we should use writer due to sticky after transaction.
305
296
 
@@ -315,7 +306,7 @@ Check if we should use writer due to sticky after transaction.
315
306
  protected static _getTransactionContext(): AsyncLocalStorage<TransactionContext>;
316
307
  ```
317
308
 
318
- Defined in: DBModel.ts:357
309
+ Defined in: [DBModel.ts:518](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L518)
319
310
 
320
311
  Get transaction context storage.
321
312
  Override in subclass to use independent transaction context.
@@ -332,7 +323,7 @@ Override in subclass to use independent transaction context.
332
323
  protected static _getWriterContext(): AsyncLocalStorage<WriterContext>;
333
324
  ```
334
325
 
335
- Defined in: DBModel.ts:365
326
+ Defined in: [DBModel.ts:526](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L526)
336
327
 
337
328
  Get writer context storage.
338
329
  Override in subclass to use independent writer context.
@@ -349,7 +340,7 @@ Override in subclass to use independent writer context.
349
340
  static inWriterContext(): boolean;
350
341
  ```
351
342
 
352
- Defined in: DBModel.ts:372
343
+ Defined in: [DBModel.ts:533](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L533)
353
344
 
354
345
  Check if currently in a withWriter context.
355
346
 
@@ -365,7 +356,7 @@ Check if currently in a withWriter context.
365
356
  static use(MiddlewareClass: MiddlewareClass): () => void;
366
357
  ```
367
358
 
368
- Defined in: DBModel.ts:415
359
+ Defined in: [DBModel.ts:576](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L576)
369
360
 
370
361
  Register a middleware class to intercept DBModel methods.
371
362
 
@@ -381,13 +372,7 @@ Each request gets its own middleware instance via AsyncLocalStorage.
381
372
 
382
373
  Function to unregister the middleware
383
374
 
384
- ```ts
385
- (): void;
386
- ```
387
-
388
- ##### Returns
389
-
390
- `void`
375
+ () => `void`
391
376
 
392
377
  #### Example
393
378
 
@@ -422,7 +407,7 @@ console.log(LoggerMiddleware.getCurrentContext().getLogs());
422
407
  static createMiddleware<S>(config: MiddlewareConfig<S>): CreatedMiddlewareClass<S>;
423
408
  ```
424
409
 
425
- Defined in: DBModel.ts:467
410
+ Defined in: [DBModel.ts:628](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L628)
426
411
 
427
412
  Create a middleware class from a configuration object.
428
413
 
@@ -488,7 +473,7 @@ TenantMiddleware.getCurrentContext().tenantId = 123;
488
473
  static removeMiddleware(MiddlewareClass: MiddlewareClass): boolean;
489
474
  ```
490
475
 
491
- Defined in: DBModel.ts:478
476
+ Defined in: [DBModel.ts:639](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L639)
492
477
 
493
478
  Remove a middleware class
494
479
 
@@ -512,7 +497,7 @@ true if middleware was found and removed
512
497
  static clearMiddlewares(): void;
513
498
  ```
514
499
 
515
- Defined in: DBModel.ts:490
500
+ Defined in: [DBModel.ts:651](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L651)
516
501
 
517
502
  Clear all middlewares (useful for testing)
518
503
 
@@ -528,7 +513,7 @@ Clear all middlewares (useful for testing)
528
513
  static getMiddlewares(): readonly MiddlewareClass[];
529
514
  ```
530
515
 
531
- Defined in: DBModel.ts:497
516
+ Defined in: [DBModel.ts:658](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L658)
532
517
 
533
518
  Get registered middleware classes
534
519
 
@@ -544,14 +529,14 @@ readonly [`MiddlewareClass`](../globals.md#middlewareclass)[]
544
529
  static buildSelectSQL<T>(
545
530
  this: T,
546
531
  conditions: ConditionObject,
547
- options: SelectOptions,
548
- params: unknown[]): {
532
+ options?: SelectOptions,
533
+ params?: unknown[]): {
549
534
  sql: string;
550
535
  params: unknown[];
551
536
  };
552
537
  ```
553
538
 
554
- Defined in: DBModel.ts:684
539
+ Defined in: [DBModel.ts:848](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L848)
555
540
 
556
541
  Build SELECT SQL without executing.
557
542
  Useful for constructing CTE/subquery SQL fragments.
@@ -585,8 +570,8 @@ Object with sql and params
585
570
 
586
571
  | Name | Type | Defined in |
587
572
  | ------ | ------ | ------ |
588
- | `sql` | `string` | DBModel.ts:689 |
589
- | `params` | `unknown`[] | DBModel.ts:689 |
573
+ | `sql` | `string` | [DBModel.ts:853](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L853) |
574
+ | `params` | `unknown`[] | [DBModel.ts:853](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L853) |
590
575
 
591
576
  #### Example
592
577
 
@@ -602,16 +587,38 @@ const { sql, params } = User.buildSelectSQL(
602
587
 
603
588
  ***
604
589
 
590
+ ### \_mergeFindFilter()
591
+
592
+ ```ts
593
+ protected static _mergeFindFilter(conditions: ConditionObject): ConditionObject;
594
+ ```
595
+
596
+ Defined in: [DBModel.ts:935](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L935)
597
+
598
+ Merge FIND_FILTER (the model's default filter) into a condition object (v1 `_buildSelectSQL` parity).
599
+
600
+ #### Parameters
601
+
602
+ | Parameter | Type |
603
+ | ------ | ------ |
604
+ | `conditions` | `ConditionObject` |
605
+
606
+ #### Returns
607
+
608
+ `ConditionObject`
609
+
610
+ ***
611
+
605
612
  ### inSubquery()
606
613
 
607
614
  ```ts
608
615
  static inSubquery<T, S>(
609
616
  this: T,
610
617
  keyPairs: KeyPair | CompositeKeyPairs,
611
- conditions: readonly [Column<any, S>, unknown][]): readonly [string, DBSubquery];
618
+ conditions?: readonly [Column<any, S>, unknown][]): readonly [string, DBSubquery];
612
619
  ```
613
620
 
614
- Defined in: DBModel.ts:1208
621
+ Defined in: [DBModel.ts:1499](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1499)
615
622
 
616
623
  IN subquery condition.
617
624
  Creates a condition like: column IN (SELECT selectColumn FROM targetModel WHERE ...)
@@ -676,10 +683,10 @@ await User.find([
676
683
  static notInSubquery<T, S>(
677
684
  this: T,
678
685
  keyPairs: KeyPair | CompositeKeyPairs,
679
- conditions: readonly [Column<any, S>, unknown][]): readonly [string, DBSubquery];
686
+ conditions?: readonly [Column<any, S>, unknown][]): readonly [string, DBSubquery];
680
687
  ```
681
688
 
682
- Defined in: DBModel.ts:1256
689
+ Defined in: [DBModel.ts:1547](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1547)
683
690
 
684
691
  NOT IN subquery condition.
685
692
  Creates a condition like: table.column NOT IN (SELECT table.column FROM targetModel WHERE ...)
@@ -732,7 +739,7 @@ await User.find([
732
739
  static exists<S>(conditions: readonly [Column<any, S>, unknown][]): readonly [string, DBExists];
733
740
  ```
734
741
 
735
- Defined in: DBModel.ts:1299
742
+ Defined in: [DBModel.ts:1590](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1590)
736
743
 
737
744
  EXISTS subquery condition.
738
745
  Creates a condition like: EXISTS (SELECT 1 FROM targetModel WHERE table.column = ...)
@@ -779,7 +786,7 @@ await User.find([
779
786
  static notExists<S>(conditions: readonly [Column<any, S>, unknown][]): readonly [string, DBExists];
780
787
  ```
781
788
 
782
- Defined in: DBModel.ts:1334
789
+ Defined in: [DBModel.ts:1625](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1625)
783
790
 
784
791
  NOT EXISTS subquery condition.
785
792
  Creates a condition like: NOT EXISTS (SELECT 1 FROM targetModel WHERE table.column = ...)
@@ -825,7 +832,7 @@ await User.find([
825
832
  static getTableName(): string;
826
833
  ```
827
834
 
828
- Defined in: DBModel.ts:1423
835
+ Defined in: [DBModel.ts:1706](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1706)
829
836
 
830
837
  Get table name for SELECT queries.
831
838
  For query-based models, returns the CTE alias (TABLE_NAME).
@@ -842,7 +849,7 @@ For query-based models, returns the CTE alias (TABLE_NAME).
842
849
  static isQueryBased(): boolean;
843
850
  ```
844
851
 
845
- Defined in: DBModel.ts:1481
852
+ Defined in: [DBModel.ts:1764](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1764)
846
853
 
847
854
  Check if this model is query-based (uses QUERY instead of TABLE_NAME)
848
855
 
@@ -865,7 +872,7 @@ static withQuery<T>(this: T, queryConfig:
865
872
  }): T;
866
873
  ```
867
874
 
868
- Defined in: DBModel.ts:1510
875
+ Defined in: [DBModel.ts:1793](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1793)
869
876
 
870
877
  Create a new model class bound to specific query parameters.
871
878
  Used for parameterized query-based models.
@@ -916,7 +923,7 @@ class SalesReportModel extends DBModel {
916
923
  static getUpdateTableName(): string;
917
924
  ```
918
925
 
919
- Defined in: DBModel.ts:1560
926
+ Defined in: [DBModel.ts:1843](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1843)
920
927
 
921
928
  Get table name for UPDATE/DELETE queries.
922
929
  Query-based models cannot be updated/deleted directly.
@@ -933,7 +940,7 @@ Query-based models cannot be updated/deleted directly.
933
940
  clearRelationCache(): void;
934
941
  ```
935
942
 
936
- Defined in: DBModel.ts:1624
943
+ Defined in: [DBModel.ts:1907](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L1907)
937
944
 
938
945
  Clear the relation cache for this instance.
939
946
  Also clears the context cache to force reload from DB.
@@ -950,7 +957,7 @@ Also clears the context cache to force reload from DB.
950
957
  typeCastFromDB(): void;
951
958
  ```
952
959
 
953
- Defined in: DBModel.ts:1764
960
+ Defined in: [DBModel.ts:2047](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2047)
954
961
 
955
962
  Called after loading from DB to convert types
956
963
  Override in derived class to implement type conversions
@@ -976,7 +983,7 @@ typeCastFromDB(): void {
976
983
  getPkey(): Record<string, unknown> | null;
977
984
  ```
978
985
 
979
- Defined in: DBModel.ts:1776
986
+ Defined in: [DBModel.ts:2059](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2059)
980
987
 
981
988
  Get primary key as object
982
989
 
@@ -994,7 +1001,7 @@ Object with primary key column names and values, or null if not set
994
1001
  setPkey(key: unknown): void;
995
1002
  ```
996
1003
 
997
- Defined in: DBModel.ts:1797
1004
+ Defined in: [DBModel.ts:2080](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2080)
998
1005
 
999
1006
  Set primary key value
1000
1007
 
@@ -1016,7 +1023,7 @@ Set primary key value
1016
1023
  getPkeyString(): string;
1017
1024
  ```
1018
1025
 
1019
- Defined in: DBModel.ts:1815
1026
+ Defined in: [DBModel.ts:2098](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2098)
1020
1027
 
1021
1028
  Get primary key as string (for logging, caching, etc.)
1022
1029
 
@@ -1032,7 +1039,7 @@ Get primary key as string (for logging, caching, etc.)
1032
1039
  getSingleColId(): unknown;
1033
1040
  ```
1034
1041
 
1035
- Defined in: DBModel.ts:1827
1042
+ Defined in: [DBModel.ts:2110](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2110)
1036
1043
 
1037
1044
  Get single-column ID value
1038
1045
 
@@ -1050,7 +1057,7 @@ ID value or undefined
1050
1057
  clone<T>(this: T): T;
1051
1058
  ```
1052
1059
 
1053
- Defined in: DBModel.ts:1842
1060
+ Defined in: [DBModel.ts:2125](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2125)
1054
1061
 
1055
1062
  Create a shallow copy of the model instance
1056
1063
 
@@ -1078,7 +1085,7 @@ Create a shallow copy of the model instance
1078
1085
  assign(source: Partial<this>): this;
1079
1086
  ```
1080
1087
 
1081
- Defined in: DBModel.ts:1850
1088
+ Defined in: [DBModel.ts:2133](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2133)
1082
1089
 
1083
1090
  Copy properties from another object
1084
1091
 
@@ -1100,7 +1107,7 @@ Copy properties from another object
1100
1107
  toObject(): Record<string, unknown>;
1101
1108
  ```
1102
1109
 
1103
- Defined in: DBModel.ts:1861
1110
+ Defined in: [DBModel.ts:2144](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2144)
1104
1111
 
1105
1112
  Convert to plain object
1106
1113
 
@@ -1116,7 +1123,7 @@ Convert to plain object
1116
1123
  toJSON(): Record<string, unknown>;
1117
1124
  ```
1118
1125
 
1119
- Defined in: DBModel.ts:1874
1126
+ Defined in: [DBModel.ts:2157](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2157)
1120
1127
 
1121
1128
  Convert to JSON-serializable object
1122
1129
 
@@ -1132,7 +1139,7 @@ Convert to JSON-serializable object
1132
1139
  static fromObject<T>(this: () => T, obj: Record<string, unknown>): T;
1133
1140
  ```
1134
1141
 
1135
- Defined in: DBModel.ts:1885
1142
+ Defined in: [DBModel.ts:2168](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2168)
1136
1143
 
1137
1144
  Create an instance from a plain object
1138
1145
 
@@ -1161,7 +1168,7 @@ Create an instance from a plain object
1161
1168
  static fromObjects<T>(this: () => T, objs: Record<string, unknown>[]): T[];
1162
1169
  ```
1163
1170
 
1164
- Defined in: DBModel.ts:1898
1171
+ Defined in: [DBModel.ts:2181](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2181)
1165
1172
 
1166
1173
  Create multiple instances from an array of plain objects
1167
1174
 
@@ -1190,7 +1197,7 @@ Create multiple instances from an array of plain objects
1190
1197
  static columnList<T>(records: T[], columnName: string): unknown[];
1191
1198
  ```
1192
1199
 
1193
- Defined in: DBModel.ts:1908
1200
+ Defined in: [DBModel.ts:2191](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2191)
1194
1201
 
1195
1202
  Get column values from an array of model instances
1196
1203
 
@@ -1219,7 +1226,7 @@ Get column values from an array of model instances
1219
1226
  static hashByProperty<T>(records: T[], propertyKey: string): Record<string, T>;
1220
1227
  ```
1221
1228
 
1222
- Defined in: DBModel.ts:1918
1229
+ Defined in: [DBModel.ts:2201](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2201)
1223
1230
 
1224
1231
  Create a hash map by property value
1225
1232
 
@@ -1248,7 +1255,7 @@ Create a hash map by property value
1248
1255
  static groupByProperty<T>(records: T[], propertyKey: string): Record<string, T[]>;
1249
1256
  ```
1250
1257
 
1251
- Defined in: DBModel.ts:1933
1258
+ Defined in: [DBModel.ts:2216](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2216)
1252
1259
 
1253
1260
  Group records by property value
1254
1261
 
@@ -1277,7 +1284,7 @@ Group records by property value
1277
1284
  static idList<T>(records: T[], column?: string): unknown[];
1278
1285
  ```
1279
1286
 
1280
- Defined in: DBModel.ts:1951
1287
+ Defined in: [DBModel.ts:2234](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2234)
1281
1288
 
1282
1289
  Get ID list from records
1283
1290
 
@@ -1305,11 +1312,11 @@ Get ID list from records
1305
1312
  ```ts
1306
1313
  static makeLikeString(
1307
1314
  src: string,
1308
- front: boolean,
1309
- back: boolean): string;
1315
+ front?: boolean,
1316
+ back?: boolean): string;
1310
1317
  ```
1311
1318
 
1312
- Defined in: DBModel.ts:1959
1319
+ Defined in: [DBModel.ts:2242](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2242)
1313
1320
 
1314
1321
  Generate LIKE pattern string
1315
1322
 
@@ -1333,7 +1340,7 @@ Generate LIKE pattern string
1333
1340
  static or<T>(this: T, ...condGroups: readonly CondsOf<T>[]): OrCondOf<T>;
1334
1341
  ```
1335
1342
 
1336
- Defined in: DBModel.ts:1996
1343
+ Defined in: [DBModel.ts:2279](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2279)
1337
1344
 
1338
1345
  Create a type-safe OR condition for this model.
1339
1346
  All columns in the conditions must belong to this model.
@@ -1384,7 +1391,7 @@ static find<T>(
1384
1391
  options?: SelectOptions): Promise<InstanceType<T>[]>;
1385
1392
  ```
1386
1393
 
1387
- Defined in: DBModel.ts:2032
1394
+ Defined in: [DBModel.ts:2315](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2315)
1388
1395
 
1389
1396
  Find all records using type-safe condition tuples.
1390
1397
  All columns in conditions must belong to this model.
@@ -1438,7 +1445,7 @@ static findOne<T>(
1438
1445
  options?: SelectOptions): Promise<InstanceType<T> | null>;
1439
1446
  ```
1440
1447
 
1441
- Defined in: DBModel.ts:2078
1448
+ Defined in: [DBModel.ts:2361](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2361)
1442
1449
 
1443
1450
  Find first record using type-safe condition tuples.
1444
1451
 
@@ -1481,7 +1488,7 @@ static findById<T>(
1481
1488
  options?: SelectOptions): Promise<InstanceType<T>[]>;
1482
1489
  ```
1483
1490
 
1484
- Defined in: DBModel.ts:2117
1491
+ Defined in: [DBModel.ts:2400](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2400)
1485
1492
 
1486
1493
  Find records by primary key using PkeyResult format.
1487
1494
  Efficiently fetches multiple records by their primary keys.
@@ -1533,7 +1540,7 @@ const users = await User.findById(result);
1533
1540
  static count<T>(this: T, conditions: CondsOf<T>): Promise<number>;
1534
1541
  ```
1535
1542
 
1536
- Defined in: DBModel.ts:2182
1543
+ Defined in: [DBModel.ts:2465](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2465)
1537
1544
 
1538
1545
  Count records using type-safe condition tuples.
1539
1546
 
@@ -1573,7 +1580,7 @@ static create<T, P>(
1573
1580
  options?: InsertOptions<InstanceType<T>>): Promise<PkeyResult | null>;
1574
1581
  ```
1575
1582
 
1576
- Defined in: DBModel.ts:2217
1583
+ Defined in: [DBModel.ts:2500](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2500)
1577
1584
 
1578
1585
  Create a new record using type-safe column-value tuples.
1579
1586
  Value types are validated at compile time.
@@ -1627,7 +1634,7 @@ static createMany<T>(
1627
1634
  options?: InsertOptions<InstanceType<T>>): Promise<PkeyResult | null>;
1628
1635
  ```
1629
1636
 
1630
- Defined in: DBModel.ts:2287
1637
+ Defined in: [DBModel.ts:2570](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2570)
1631
1638
 
1632
1639
  Create multiple records using type-safe column-value tuples.
1633
1640
 
@@ -1680,7 +1687,7 @@ static update<T, V>(
1680
1687
  options?: UpdateOptions): Promise<PkeyResult | null>;
1681
1688
  ```
1682
1689
 
1683
- Defined in: DBModel.ts:2357
1690
+ Defined in: [DBModel.ts:2640](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2640)
1684
1691
 
1685
1692
  Update records using type-safe column-value tuples.
1686
1693
  Value types are validated at compile time.
@@ -1736,7 +1743,7 @@ static delete<T>(
1736
1743
  options?: DeleteOptions): Promise<PkeyResult | null>;
1737
1744
  ```
1738
1745
 
1739
- Defined in: DBModel.ts:2436
1746
+ Defined in: [DBModel.ts:2719](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2719)
1740
1747
 
1741
1748
  Delete records matching conditions
1742
1749
 
@@ -1782,7 +1789,7 @@ static updateMany<T>(
1782
1789
  options: UpdateManyOptions): Promise<PkeyResult | null>;
1783
1790
  ```
1784
1791
 
1785
- Defined in: DBModel.ts:2514
1792
+ Defined in: [DBModel.ts:2797](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2797)
1786
1793
 
1787
1794
  Update multiple records with different values per row.
1788
1795
  Uses efficient bulk update strategies (UNNEST for PostgreSQL, VALUES for MySQL/SQLite).
@@ -1834,7 +1841,7 @@ const users = await User.findById(result);
1834
1841
  static execute(sql: string, params?: unknown[]): Promise<ExecuteResult>;
1835
1842
  ```
1836
1843
 
1837
- Defined in: DBModel.ts:2657
1844
+ Defined in: [DBModel.ts:2940](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2940)
1838
1845
 
1839
1846
  Execute raw SQL query.
1840
1847
  Accepts either a SQL string with params, or a `SqlFragment` from `sql` tagged template.
@@ -1877,7 +1884,7 @@ static execute(fragment:
1877
1884
  | SqlCondition<unknown>): Promise<ExecuteResult>;
1878
1885
  ```
1879
1886
 
1880
- Defined in: DBModel.ts:2658
1887
+ Defined in: [DBModel.ts:2941](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L2941)
1881
1888
 
1882
1889
  Execute raw SQL query.
1883
1890
  Accepts either a SQL string with params, or a `SqlFragment` from `sql` tagged template.
@@ -1921,7 +1928,7 @@ static query<T>(
1921
1928
  params?: unknown[]): Promise<InstanceType<T>[]>;
1922
1929
  ```
1923
1930
 
1924
- Defined in: DBModel.ts:2710
1931
+ Defined in: [DBModel.ts:3005](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3005)
1925
1932
 
1926
1933
  Execute raw SQL and return model instances.
1927
1934
  The SQL should return columns matching the model's properties.
@@ -1970,7 +1977,7 @@ const posts = await Post.query(`
1970
1977
  static inTransaction(): boolean;
1971
1978
  ```
1972
1979
 
1973
- Defined in: DBModel.ts:2742
1980
+ Defined in: [DBModel.ts:3037](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3037)
1974
1981
 
1975
1982
  Check if currently in a transaction
1976
1983
 
@@ -1983,10 +1990,10 @@ Check if currently in a transaction
1983
1990
  ### transaction()
1984
1991
 
1985
1992
  ```ts
1986
- static transaction<R>(func: () => Promise<R>, options: TransactionOptions): Promise<R>;
1993
+ static transaction<R>(func: () => Promise<R>, options?: TransactionOptions): Promise<R>;
1987
1994
  ```
1988
1995
 
1989
- Defined in: DBModel.ts:2780
1996
+ Defined in: [DBModel.ts:3075](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3075)
1990
1997
 
1991
1998
  Execute a function within a transaction
1992
1999
  All model operations inside the callback will use the same database connection.
@@ -2045,7 +2052,7 @@ await DBModel.transaction(
2045
2052
  static getCurrentConnection(): DBConnection | null;
2046
2053
  ```
2047
2054
 
2048
- Defined in: DBModel.ts:2885
2055
+ Defined in: [DBModel.ts:3219](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3219)
2049
2056
 
2050
2057
  Get current transaction connection
2051
2058
  Use this to execute raw SQL queries within a transaction
@@ -2075,7 +2082,7 @@ await DBModel.transaction(async () => {
2075
2082
  static getCurrentClient(): DBConnection | null;
2076
2083
  ```
2077
2084
 
2078
- Defined in: DBModel.ts:2893
2085
+ Defined in: [DBModel.ts:3227](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3227)
2079
2086
 
2080
2087
  #### Returns
2081
2088
 
@@ -2093,7 +2100,7 @@ Use getCurrentConnection() instead
2093
2100
  static withWriter<R>(func: () => Promise<R>): Promise<R>;
2094
2101
  ```
2095
2102
 
2096
- Defined in: DBModel.ts:2918
2103
+ Defined in: [DBModel.ts:3252](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3252)
2097
2104
 
2098
2105
  Execute a function with explicit writer connection access.
2099
2106
  Use this when you need to read from writer to avoid replication lag.
@@ -2139,7 +2146,7 @@ await DBModel.withWriter(async () => {
2139
2146
  static createDBBase(config: DBConfig, options?: DBConfigOptions): typeof DBModel;
2140
2147
  ```
2141
2148
 
2142
- Defined in: DBModel.ts:2980
2149
+ Defined in: [DBModel.ts:3314](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3314)
2143
2150
 
2144
2151
  Create an independent database base class.
2145
2152
  Use this to connect to multiple databases with isolated configurations.
@@ -2195,10 +2202,10 @@ await BaseDB.transaction(async () => {
2195
2202
  ### reload()
2196
2203
 
2197
2204
  ```ts
2198
- reload(forUpdate: boolean): Promise<DBModel | null>;
2205
+ reload(forUpdate?: boolean): Promise<DBModel | null>;
2199
2206
  ```
2200
2207
 
2201
- Defined in: DBModel.ts:3050
2208
+ Defined in: [DBModel.ts:3388](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBModel.ts#L3388)
2202
2209
 
2203
2210
  Reload this instance from the database
2204
2211