tspace-mysql 1.9.2 → 1.9.3-beta.2
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 +142 -17
- package/dist/lib/core/Abstracts/AbstractBuilder.d.ts +0 -1
- package/dist/lib/core/Abstracts/AbstractBuilder.js.map +1 -1
- package/dist/lib/core/Blueprint.d.ts +43 -10
- package/dist/lib/core/Blueprint.js +43 -2
- package/dist/lib/core/Blueprint.js.map +1 -1
- package/dist/lib/core/Builder.d.ts +5 -5
- package/dist/lib/core/Builder.js +15 -12
- package/dist/lib/core/Builder.js.map +1 -1
- package/dist/lib/core/Cache/MemoryCache.js +9 -4
- package/dist/lib/core/Cache/MemoryCache.js.map +1 -1
- package/dist/lib/core/Contracts/Audit.d.ts +2 -2
- package/dist/lib/core/Contracts/Logger.d.ts +2 -2
- package/dist/lib/core/Model.d.ts +169 -29
- package/dist/lib/core/Model.js +153 -4
- package/dist/lib/core/Model.js.map +1 -1
- package/dist/lib/core/{Queue.d.ts → Queue/index.d.ts} +115 -91
- package/dist/lib/core/Queue/index.js +282 -0
- package/dist/lib/core/Queue/index.js.map +1 -0
- package/dist/lib/core/Queue/types.d.ts +39 -0
- package/dist/lib/core/Queue/types.js +3 -0
- package/dist/lib/core/Queue/types.js.map +1 -0
- package/dist/lib/core/Queue/worker.d.ts +102 -0
- package/dist/lib/core/{Queue.js → Queue/worker.js} +133 -268
- package/dist/lib/core/Queue/worker.js.map +1 -0
- package/dist/lib/core/Repository.d.ts +40 -20
- package/dist/lib/core/Repository.js +35 -14
- package/dist/lib/core/Repository.js.map +1 -1
- package/dist/lib/core/UtilityTypes.d.ts +9 -7
- package/dist/lib/core/UtilityTypes.js.map +1 -1
- package/dist/lib/types/decorator/index.d.ts +3 -0
- package/dist/lib/types/index.d.ts +17 -16
- package/dist/lib/types/repository/index.d.ts +3 -3
- package/dist/lib/utils/index.d.ts +4 -2
- package/dist/lib/utils/index.js +17 -1
- package/dist/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/lib/core/Queue.js.map +0 -1
package/dist/lib/core/Model.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
64
64
|
static get table(): string | null;
|
|
65
65
|
/**
|
|
66
66
|
* The 'formatPattern' method is used to change the format of the pattern.
|
|
67
|
+
* @static
|
|
67
68
|
* @param {object} data { data , pattern }
|
|
68
69
|
* @property {Record | string} data
|
|
69
70
|
* @property {string} parttern
|
|
@@ -75,6 +76,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
75
76
|
}): T;
|
|
76
77
|
/**
|
|
77
78
|
* The 'instance' method is used get instance.
|
|
79
|
+
* @static
|
|
78
80
|
* @override
|
|
79
81
|
* @static
|
|
80
82
|
* @returns {Model} instance of the Model
|
|
@@ -93,6 +95,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
93
95
|
* The 'find' method is used to retrieve a single record from a database table by its primary key.
|
|
94
96
|
*
|
|
95
97
|
* It allows you to retrieve a single record from a database table that meets the specified criteria.
|
|
98
|
+
* @static
|
|
96
99
|
* @type {?object} options
|
|
97
100
|
* @property {?object} options.select
|
|
98
101
|
* @property {?object} options.except
|
|
@@ -131,6 +134,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
131
134
|
* The 'findOne' method is used to retrieve the get record that matches the query conditions.
|
|
132
135
|
*
|
|
133
136
|
* It allows you to retrieve a single record from a database table that meets the specified criteria.
|
|
137
|
+
* @static
|
|
134
138
|
* @type {?object} options
|
|
135
139
|
* @property {?object} options.select
|
|
136
140
|
* @property {?object} options.except
|
|
@@ -169,6 +173,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
169
173
|
* The 'findMany' method is used to retrieve the get record that matches the query conditions.
|
|
170
174
|
*
|
|
171
175
|
* It allows you to retrieve a single record from a database table that meets the specified criteria.
|
|
176
|
+
* @static
|
|
172
177
|
* @type {?object} options
|
|
173
178
|
* @property {?object} options.select
|
|
174
179
|
* @property {?object} options.except
|
|
@@ -208,6 +213,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
208
213
|
*
|
|
209
214
|
* It allows you to split a large set of query results into smaller, more manageable pages,
|
|
210
215
|
* making it easier to display data in a web application and improve user experience.
|
|
216
|
+
* @static
|
|
211
217
|
* @type {?object} options
|
|
212
218
|
* @property {?object} options.select
|
|
213
219
|
* @property {?object} options.except
|
|
@@ -249,6 +255,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
249
255
|
* The 'exists' method is used to determine if any records exist in the database table that match the query conditions.
|
|
250
256
|
*
|
|
251
257
|
* It returns a boolean value indicating whether there are any matching records.
|
|
258
|
+
* @static
|
|
252
259
|
* @type {?object} options
|
|
253
260
|
* @property {?object} options.select
|
|
254
261
|
* @property {?object} options.except
|
|
@@ -277,11 +284,46 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
277
284
|
* })
|
|
278
285
|
*
|
|
279
286
|
*/
|
|
280
|
-
static exists<Self extends Model, M extends Model = Self>(this: new () => Self, options: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<boolean>;
|
|
287
|
+
static exists<Self extends Model, M extends Model = Self>(this: new () => Self, options: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationsExists" | "relationQuery">>): Promise<boolean>;
|
|
281
288
|
/**
|
|
282
289
|
* The 'toQuery' method is used to retrieve the raw SQL query that would be executed by a query builder instance without actually executing it.
|
|
283
290
|
*
|
|
284
291
|
* This method is particularly useful for debugging and understanding the SQL queries generated by your application.
|
|
292
|
+
* @static
|
|
293
|
+
* @type {?object} options
|
|
294
|
+
* @property {?object} options.select
|
|
295
|
+
* @property {?object} options.except
|
|
296
|
+
* @property {?object[]} options.orderBy
|
|
297
|
+
* @property {?string[]} options.groupBy
|
|
298
|
+
* @property {?string} options.having
|
|
299
|
+
* @property {?number} options.limit
|
|
300
|
+
* @property {?number} options.offset
|
|
301
|
+
* @property {?object} options.where
|
|
302
|
+
* @property {?string[]} options.whereRaw
|
|
303
|
+
* @property {?object} options.whereQuery
|
|
304
|
+
* @property {?{condition,callback}} options.when
|
|
305
|
+
* @property {?{localKey , referenceKey}[]} options.join
|
|
306
|
+
* @property {?{localKey , referenceKey}[]} options.rightJoin
|
|
307
|
+
* @property {?{localKey , referenceKey}[]} options.leftJoin
|
|
308
|
+
* @property {?boolean} options.debug
|
|
309
|
+
* @property {?number} options.page
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* import { User } from '../Models/User'
|
|
313
|
+
*
|
|
314
|
+
* const users = await User.exists({
|
|
315
|
+
* where : {
|
|
316
|
+
* id: 1
|
|
317
|
+
* }
|
|
318
|
+
* })
|
|
319
|
+
*
|
|
320
|
+
*/
|
|
321
|
+
static toQuery<Self extends Model, M extends Model = Self>(this: new () => Self, options: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationsExists" | "relationQuery">>): string;
|
|
322
|
+
/**
|
|
323
|
+
* The 'toArray' method is used to retrieve the raw SQL query that would be executed by a query builder instance without actually executing it.
|
|
324
|
+
*
|
|
325
|
+
* This method is particularly useful for debugging and understanding the SQL queries generated by your application.
|
|
326
|
+
* @static
|
|
285
327
|
* @type {?object} options
|
|
286
328
|
* @property {?object} options.select
|
|
287
329
|
* @property {?object} options.except
|
|
@@ -310,11 +352,52 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
310
352
|
* })
|
|
311
353
|
*
|
|
312
354
|
*/
|
|
313
|
-
static
|
|
355
|
+
static toArray<Self extends Model, K extends T.ColumnKeys<M> | `${string}.${string}`, M extends Model = Self>(this: new () => Self, column: K, options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationsExists" | "relationQuery">>): Promise<(K extends keyof T.Result<M> ? T.Result<M>[K] : unknown)[]>;
|
|
356
|
+
/**
|
|
357
|
+
*
|
|
358
|
+
* The 'toAsyncIterable' method is used to execute a database query and return the result set as an asynchronous iterable.
|
|
359
|
+
*
|
|
360
|
+
* It retrieves multiple records from a database table based on the criteria specified in the query.
|
|
361
|
+
* The optional callback function can be used to modify the generated SQL query before execution.
|
|
362
|
+
* @static
|
|
363
|
+
* @type {?object} options
|
|
364
|
+
* @property {?object} options.select
|
|
365
|
+
* @property {?object} options.except
|
|
366
|
+
* @property {?object[]} options.orderBy
|
|
367
|
+
* @property {?string[]} options.groupBy
|
|
368
|
+
* @property {?string} options.having
|
|
369
|
+
* @property {?number} options.limit
|
|
370
|
+
* @property {?number} options.offset
|
|
371
|
+
* @property {?object} options.where
|
|
372
|
+
* @property {?string[]} options.whereRaw
|
|
373
|
+
* @property {?object} options.whereQuery
|
|
374
|
+
* @property {?{condition,callback}} options.when
|
|
375
|
+
* @property {?{localKey , referenceKey}[]} options.join
|
|
376
|
+
* @property {?{localKey , referenceKey}[]} options.rightJoin
|
|
377
|
+
* @property {?{localKey , referenceKey}[]} options.leftJoin
|
|
378
|
+
* @property {?string[]} options.relations
|
|
379
|
+
* @property {string[]} options.relationExists
|
|
380
|
+
* @property {?{condition,callback}} options.relationQuery
|
|
381
|
+
* @property {?boolean} options.debug
|
|
382
|
+
* @returns {promise<object>[]}
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* import { User } from '../Models/User'
|
|
386
|
+
*
|
|
387
|
+
* const users = await User.findMany({
|
|
388
|
+
* select : { id: true, name: true },
|
|
389
|
+
* where : {
|
|
390
|
+
* id: 1
|
|
391
|
+
* }
|
|
392
|
+
* })
|
|
393
|
+
*
|
|
394
|
+
*/
|
|
395
|
+
static toAsyncIterable<Self extends Model, M extends Model = Self, S extends T.SelectOptions<M> | undefined = undefined, SR extends T.RelationOptions<M> | undefined = undefined, E extends T.ExceptOptions<M> | undefined = undefined, SRS extends Record<string, TRawStringQuery> | undefined = undefined, G extends Record<string, T.RepositoryGenericTypeOptions> | undefined = {}>(this: new () => Self, options?: T.RepositoryOptions<M, S, SR, E, SRS, G>): AsyncIterable<T.ResultFiltered<M, S, SR, E, SRS, G>>;
|
|
314
396
|
/**
|
|
315
397
|
* The 'create' method is used to insert a new record into a database table associated.
|
|
316
398
|
*
|
|
317
399
|
* It simplifies the process of creating and inserting records.
|
|
400
|
+
* @static
|
|
318
401
|
* @type {object} options
|
|
319
402
|
* @property {object} options.data
|
|
320
403
|
* @property {?boolean} options.debug
|
|
@@ -326,6 +409,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
326
409
|
* The 'createMany' method is used to insert a new records into a database table associated.
|
|
327
410
|
*
|
|
328
411
|
* It simplifies the process of creating and inserting records with an array.
|
|
412
|
+
* @static
|
|
329
413
|
* @type {object} options
|
|
330
414
|
* @property {object[]} options.data
|
|
331
415
|
* @property {?boolean} options.debug
|
|
@@ -339,6 +423,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
339
423
|
*
|
|
340
424
|
* This method is particularly useful when you want to update a record based on certain conditions and,
|
|
341
425
|
* if the record matching those conditions doesn't exist, create a new one with the provided data.
|
|
426
|
+
* @static
|
|
342
427
|
* @type {object} options
|
|
343
428
|
* @property {object} options.data
|
|
344
429
|
* @property {object} options.where
|
|
@@ -351,7 +436,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
351
436
|
*
|
|
352
437
|
* This method is particularly useful when you want to insert records into a table and ensure that duplicates are not inserted,
|
|
353
438
|
* but without raising an error or exception if duplicates are encountered.
|
|
354
|
-
*
|
|
439
|
+
* @static
|
|
355
440
|
* @type {object} options
|
|
356
441
|
* @property {object} options.data
|
|
357
442
|
* @property {object} options.where
|
|
@@ -366,6 +451,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
366
451
|
*
|
|
367
452
|
* This method is particularly useful when you want to insert records into a table and ensure that duplicates are not inserted,
|
|
368
453
|
* but if exists should be returns a result.
|
|
454
|
+
* @static
|
|
369
455
|
* @type {object} options
|
|
370
456
|
* @property {object} options.data
|
|
371
457
|
* @property {object} options.where
|
|
@@ -379,6 +465,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
379
465
|
* It simplifies the process of updating records by allowing you to specify the values to be updated using a single call.
|
|
380
466
|
*
|
|
381
467
|
* It allows you to remove one record that match certain criteria.
|
|
468
|
+
* @static
|
|
382
469
|
* @type {object} options
|
|
383
470
|
* @property {object} options.data
|
|
384
471
|
* @property {object} options.where
|
|
@@ -393,6 +480,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
393
480
|
* It simplifies the process of updating records by allowing you to specify the values to be updated using a single call.
|
|
394
481
|
*
|
|
395
482
|
* It allows you to remove more records that match certain criteria.
|
|
483
|
+
* @static
|
|
396
484
|
* @type {object} options
|
|
397
485
|
* @property {object} options.data
|
|
398
486
|
* @property {object} options.where
|
|
@@ -402,8 +490,52 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
402
490
|
*/
|
|
403
491
|
static updateMany<Self extends Model, M extends Model = Self, NR extends boolean | undefined = false>(this: new () => Self, options: T.RepositoryUpdate<M, NR>): Promise<NR extends true ? undefined : T.Result<M>[]>;
|
|
404
492
|
/**
|
|
405
|
-
* The 'cache' method is used
|
|
406
|
-
*
|
|
493
|
+
* The 'cache' method is used to access to cache operations for the current model.
|
|
494
|
+
*
|
|
495
|
+
* The cache API exposes methods for retrieving the configured cache provider,
|
|
496
|
+
* selecting a cache driver, managing cache entries, and optionally generating
|
|
497
|
+
* model-scoped cache keys.
|
|
498
|
+
*
|
|
499
|
+
* When the `namespace` option is enabled, cache keys are automatically prefixed
|
|
500
|
+
* with the current database and table name in the following format:
|
|
501
|
+
*
|
|
502
|
+
* `database:table:key`
|
|
503
|
+
*
|
|
504
|
+
* This helps prevent cache key collisions between different models or tables.
|
|
505
|
+
* @static
|
|
506
|
+
* @returns {TCacheModel} An object containing cache provider, driver, and cache management methods.
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* // Get the configured cache provider.
|
|
510
|
+
* const provider = User.cache.provider(); // "db" | "memory" | "redis"
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* // Store a value using a model-scoped cache key.
|
|
514
|
+
* await User.cache.set("users", users, 60_000, {
|
|
515
|
+
* namespace: true
|
|
516
|
+
* });
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* // Retrieve a model-scoped cache value.
|
|
520
|
+
* const users = await User.cache.get("users", {
|
|
521
|
+
* namespace: true
|
|
522
|
+
* });
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* // Check whether a cache entry exists.
|
|
526
|
+
* const exists = await User.cache.exists("users", {
|
|
527
|
+
* namespace: true
|
|
528
|
+
* });
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* // Delete a cache entry.
|
|
532
|
+
* await User.cache.delete("users", {
|
|
533
|
+
* namespace: true
|
|
534
|
+
* });
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* // Clear all cache entries.
|
|
538
|
+
* await User.cache.clear();
|
|
407
539
|
*/
|
|
408
540
|
static get cache(): TCacheModel;
|
|
409
541
|
/**
|
|
@@ -428,6 +560,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
428
560
|
* - DELETE: waits
|
|
429
561
|
*
|
|
430
562
|
* The lock is released automatically after the callback completes.
|
|
563
|
+
* @static
|
|
431
564
|
*
|
|
432
565
|
* @Note
|
|
433
566
|
* This approach is not recommended in clustered or load-balance environments,
|
|
@@ -1941,8 +2074,8 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
1941
2074
|
* @param {Object} columns
|
|
1942
2075
|
* @returns {this}
|
|
1943
2076
|
*/
|
|
1944
|
-
whereObject<K extends T.ColumnKeys<this>,
|
|
1945
|
-
[P in K & keyof
|
|
2077
|
+
whereObject<K extends T.ColumnKeys<this>, CO extends T.ColumnOptions<this>>(columns: {
|
|
2078
|
+
[P in K & keyof CO]: CO[P];
|
|
1946
2079
|
}): this;
|
|
1947
2080
|
/**
|
|
1948
2081
|
* @override
|
|
@@ -1991,28 +2124,28 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
1991
2124
|
* @param {array} array
|
|
1992
2125
|
* @returns {this}
|
|
1993
2126
|
*/
|
|
1994
|
-
whereIn<K extends T.ColumnKeys<this>>(column: K, array:
|
|
2127
|
+
whereIn<K extends T.ColumnKeys<this>, V extends T.ColumnValue<this, K>>(column: K, array: V[]): this;
|
|
1995
2128
|
/**
|
|
1996
2129
|
* @override
|
|
1997
2130
|
* @param {string} column
|
|
1998
2131
|
* @param {array} array
|
|
1999
2132
|
* @returns {this}
|
|
2000
2133
|
*/
|
|
2001
|
-
orWhereIn<K extends T.ColumnKeys<this>>(column: K, array:
|
|
2134
|
+
orWhereIn<K extends T.ColumnKeys<this>, V extends T.ColumnValue<this, K>>(column: K, array: V[]): this;
|
|
2002
2135
|
/**
|
|
2003
2136
|
* @override
|
|
2004
2137
|
* @param {string} column
|
|
2005
2138
|
* @param {array} array
|
|
2006
2139
|
* @returns {this}
|
|
2007
2140
|
*/
|
|
2008
|
-
whereNotIn<K extends T.ColumnKeys<this>>(column: K, array:
|
|
2141
|
+
whereNotIn<K extends T.ColumnKeys<this>, V extends T.ColumnValue<this, K>>(column: K, array: V[]): this;
|
|
2009
2142
|
/**
|
|
2010
2143
|
* @override
|
|
2011
2144
|
* @param {string} column
|
|
2012
2145
|
* @param {array} array
|
|
2013
2146
|
* @returns {this}
|
|
2014
2147
|
*/
|
|
2015
|
-
orWhereNotIn<K extends T.ColumnKeys<this>>(column: K, array:
|
|
2148
|
+
orWhereNotIn<K extends T.ColumnKeys<this>, V extends T.ColumnValue<this, K>>(column: K, array: V[]): this;
|
|
2016
2149
|
/**
|
|
2017
2150
|
* @override
|
|
2018
2151
|
* @param {string} column
|
|
@@ -2381,6 +2514,13 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
2381
2514
|
latest?: boolean;
|
|
2382
2515
|
oldest?: boolean;
|
|
2383
2516
|
}): string;
|
|
2517
|
+
/**
|
|
2518
|
+
*
|
|
2519
|
+
* @override
|
|
2520
|
+
* @param {Function?} cb callback function return query sql
|
|
2521
|
+
* @returns {AsyncIterable<T.Result<this, K>>}
|
|
2522
|
+
*/
|
|
2523
|
+
toAsyncIterable<K>(cb?: Function): AsyncIterable<T.Result<this, K>>;
|
|
2384
2524
|
/**
|
|
2385
2525
|
* @override
|
|
2386
2526
|
* @param {string=} column [column=id]
|
|
@@ -2493,27 +2633,27 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
2493
2633
|
* @param {object} data for insert
|
|
2494
2634
|
* @returns {this} this
|
|
2495
2635
|
*/
|
|
2496
|
-
insert<K extends T.ColumnKeys<this>, C extends T.
|
|
2636
|
+
insert<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>): Model<TS, TR, "create">;
|
|
2497
2637
|
/**
|
|
2498
2638
|
* @override
|
|
2499
2639
|
* @param {object} data for insert
|
|
2500
2640
|
* @returns {this} this
|
|
2501
2641
|
*/
|
|
2502
|
-
create<K extends T.ColumnKeys<this>, C extends T.
|
|
2642
|
+
create<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>): Model<TS, TR, "create">;
|
|
2503
2643
|
/**
|
|
2504
2644
|
* @override
|
|
2505
2645
|
* @param {object} data
|
|
2506
2646
|
* @param {array?} updateNotExists options for except update some records in your ${data}
|
|
2507
2647
|
* @returns {this} this
|
|
2508
2648
|
*/
|
|
2509
|
-
update<K extends T.ColumnKeys<this>, C extends T.
|
|
2649
|
+
update<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.UpdateInput<K, C>, updateNotExists?: T.ColumnKeys<this>[]): Model<TS, TR, "update">;
|
|
2510
2650
|
/**
|
|
2511
2651
|
* @override
|
|
2512
2652
|
* @param {object} data
|
|
2513
2653
|
* @param {array?} updateNotExists options for except update some records in your ${data}
|
|
2514
2654
|
* @returns {this} this
|
|
2515
2655
|
*/
|
|
2516
|
-
updateMany<K extends T.ColumnKeys<this>, C extends T.
|
|
2656
|
+
updateMany<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.UpdateInput<K, C>, updateNotExists?: string[]): Model<TS, TR, "updateMany">;
|
|
2517
2657
|
/**
|
|
2518
2658
|
*
|
|
2519
2659
|
* @override
|
|
@@ -2526,7 +2666,7 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
2526
2666
|
* @property {Record<string,string | number | boolean | null | undefined>} cases.columns
|
|
2527
2667
|
* @returns {this} this
|
|
2528
2668
|
*/
|
|
2529
|
-
updateCases<T extends T.
|
|
2669
|
+
updateCases<T extends T.InputOptions<this>, K extends keyof T, U extends Model | unknown, M = U extends this ? this : U extends Model ? U : this>(cases: {
|
|
2530
2670
|
condition: ((query: M) => M) | Partial<{
|
|
2531
2671
|
[P in K & keyof T]: Extract<T[P], Record<string, unknown>> extends never ? T[P] : string;
|
|
2532
2672
|
}>;
|
|
@@ -2539,84 +2679,84 @@ declare class Model<TS extends Record<string, any> = any, TR = unknown, TA exten
|
|
|
2539
2679
|
* @param {object} data
|
|
2540
2680
|
* @returns {this} this
|
|
2541
2681
|
*/
|
|
2542
|
-
updateNotExists<K extends T.ColumnKeys<this>, C extends T.
|
|
2682
|
+
updateNotExists<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.UpdateInput<K, C>): Model<TS, TR, "update">;
|
|
2543
2683
|
/**
|
|
2544
2684
|
* @override
|
|
2545
2685
|
* @param {object} data for update or create
|
|
2546
2686
|
* @returns {this} this
|
|
2547
2687
|
*/
|
|
2548
|
-
updateOrCreate<K extends T.ColumnKeys<this>, C extends T.
|
|
2688
|
+
updateOrCreate<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertOrUpdateInput<K, C>): Model<TS, TR, "createOrUpdate">;
|
|
2549
2689
|
/**
|
|
2550
2690
|
* @override
|
|
2551
2691
|
* @param {object} data for update or create
|
|
2552
2692
|
* @returns {this} this
|
|
2553
2693
|
*/
|
|
2554
|
-
updateOrInsert<K extends T.ColumnKeys<this>, C extends T.
|
|
2694
|
+
updateOrInsert<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertOrUpdateInput<K, C>): Model<TS, TR, "createOrUpdate">;
|
|
2555
2695
|
/**
|
|
2556
2696
|
* @override
|
|
2557
2697
|
* @param {object} data for update or create
|
|
2558
2698
|
* @returns {this} this
|
|
2559
2699
|
*/
|
|
2560
|
-
insertOrUpdate<K extends T.ColumnKeys<this>, C extends T.
|
|
2700
|
+
insertOrUpdate<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertOrUpdateInput<K, C>): Model<TS, TR, "createOrUpdate">;
|
|
2561
2701
|
/**
|
|
2562
2702
|
* @override
|
|
2563
2703
|
* @param {object} data for update or create
|
|
2564
2704
|
* @returns {this} this
|
|
2565
2705
|
*/
|
|
2566
|
-
createOrUpdate<K extends T.ColumnKeys<this>, C extends T.
|
|
2706
|
+
createOrUpdate<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertOrUpdateInput<K, C>): Model<TS, TR, "createOrUpdate">;
|
|
2567
2707
|
/**
|
|
2568
2708
|
* @override
|
|
2569
2709
|
* @param {object} data for create
|
|
2570
2710
|
* @returns {this} this
|
|
2571
2711
|
*/
|
|
2572
|
-
createOrSelect<K extends T.ColumnKeys<this>, C extends T.
|
|
2712
|
+
createOrSelect<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>): Model<TS, TR, "createOrSelect">;
|
|
2573
2713
|
/**
|
|
2574
2714
|
* @override
|
|
2575
2715
|
* @param {object} data for update or create
|
|
2576
2716
|
* @returns {this} this
|
|
2577
2717
|
*/
|
|
2578
|
-
insertOrSelect<K extends T.ColumnKeys<this>, C extends T.
|
|
2718
|
+
insertOrSelect<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>): Model<TS, TR, "createOrSelect">;
|
|
2579
2719
|
/**
|
|
2580
2720
|
*
|
|
2581
2721
|
* @override
|
|
2582
2722
|
* @param {object} data create not exists data
|
|
2583
2723
|
* @returns {this} this
|
|
2584
2724
|
*/
|
|
2585
|
-
createNotExists<K extends T.ColumnKeys<this>, C extends T.
|
|
2725
|
+
createNotExists<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>): Model<TS, TR, "createNotExists">;
|
|
2586
2726
|
/**
|
|
2587
2727
|
*
|
|
2588
2728
|
* @override
|
|
2589
2729
|
* @param {object} data create not exists data
|
|
2590
2730
|
* @returns {this} this this
|
|
2591
2731
|
*/
|
|
2592
|
-
insertNotExists<K extends T.ColumnKeys<this>, C extends T.
|
|
2732
|
+
insertNotExists<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>): Model<TS, TR, "createNotExists">;
|
|
2593
2733
|
/**
|
|
2594
2734
|
* @override
|
|
2595
2735
|
* @param {Record<string,any>[]} data create multiple data
|
|
2596
2736
|
* @returns {this} this this
|
|
2597
2737
|
*/
|
|
2598
|
-
createMultiple<K extends T.ColumnKeys<this>, C extends T.
|
|
2738
|
+
createMultiple<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>[]): Model<TS, TR, "createMany">;
|
|
2599
2739
|
/**
|
|
2600
2740
|
*
|
|
2601
2741
|
* @override
|
|
2602
2742
|
* @param {Record<string,any>[]} data create multiple data
|
|
2603
2743
|
* @returns {this} this
|
|
2604
2744
|
*/
|
|
2605
|
-
createMany<K extends T.ColumnKeys<this>, C extends T.
|
|
2745
|
+
createMany<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>[]): Model<TS, TR, "createMany">;
|
|
2606
2746
|
/**
|
|
2607
2747
|
*
|
|
2608
2748
|
* @override
|
|
2609
2749
|
* @param {Record<string,any>[]} data create multiple data
|
|
2610
2750
|
* @returns {this} this
|
|
2611
2751
|
*/
|
|
2612
|
-
insertMultiple<K extends T.ColumnKeys<this>, C extends T.
|
|
2752
|
+
insertMultiple<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>[]): Model<TS, TR, "createMany">;
|
|
2613
2753
|
/**
|
|
2614
2754
|
*
|
|
2615
2755
|
* @override
|
|
2616
2756
|
* @param {Record<string,any>[]} data create multiple data
|
|
2617
2757
|
* @returns {this} this
|
|
2618
2758
|
*/
|
|
2619
|
-
insertMany<K extends T.ColumnKeys<this>, C extends T.
|
|
2759
|
+
insertMany<K extends T.ColumnKeys<this>, C extends T.InputOptions<this>>(data: T.InsertInput<K, C>[]): Model<TS, TR, "createMany">;
|
|
2620
2760
|
/**
|
|
2621
2761
|
* The 'getSchemaModel' method is used get a schema model
|
|
2622
2762
|
* @returns {Record<string, Blueprint> | null} Record<string, Blueprint> | null
|