tspace-mysql 1.9.0 → 1.9.1
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 +4357 -133
- package/dist/lib/config/index.d.ts +2 -2
- package/dist/lib/config/index.js +24 -16
- package/dist/lib/config/index.js.map +1 -1
- package/dist/lib/constants/index.d.ts +10 -1
- package/dist/lib/constants/index.js +11 -2
- package/dist/lib/constants/index.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractBuilder.d.ts +11 -7
- package/dist/lib/core/Abstracts/AbstractBuilder.js +11 -13
- package/dist/lib/core/Abstracts/AbstractBuilder.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractDB.d.ts +4 -1
- package/dist/lib/core/Abstracts/AbstractDB.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractView.js.map +1 -1
- package/dist/lib/core/Blueprint.d.ts +30 -10
- package/dist/lib/core/Blueprint.js +39 -14
- package/dist/lib/core/Blueprint.js.map +1 -1
- package/dist/lib/core/Builder.d.ts +263 -9
- package/dist/lib/core/Builder.js +610 -347
- package/dist/lib/core/Builder.js.map +1 -1
- package/dist/lib/core/Cache/DBCache.js +19 -20
- package/dist/lib/core/Cache/DBCache.js.map +1 -1
- package/dist/lib/core/Cache/MemoryCache.js +3 -3
- package/dist/lib/core/Cache/MemoryCache.js.map +1 -1
- package/dist/lib/core/Cache/RedisCache.js +27 -17
- package/dist/lib/core/Cache/RedisCache.js.map +1 -1
- package/dist/lib/core/Cache/index.js +5 -4
- package/dist/lib/core/Cache/index.js.map +1 -1
- package/dist/lib/core/Contracts/AlterTable.d.ts +152 -0
- package/dist/lib/core/Contracts/AlterTable.js +243 -0
- package/dist/lib/core/Contracts/AlterTable.js.map +1 -0
- package/dist/lib/core/Contracts/Audit.js +2 -5
- package/dist/lib/core/Contracts/Audit.js.map +1 -1
- package/dist/lib/core/DB.d.ts +101 -9
- package/dist/lib/core/DB.js +168 -29
- package/dist/lib/core/DB.js.map +1 -1
- package/dist/lib/core/Decorator.d.ts +144 -16
- package/dist/lib/core/Decorator.js +156 -14
- package/dist/lib/core/Decorator.js.map +1 -1
- package/dist/lib/core/Driver/index.d.ts +43 -9
- package/dist/lib/core/Driver/index.js +9 -7
- package/dist/lib/core/Driver/index.js.map +1 -1
- package/dist/lib/core/Driver/mariadb/MariadbDriver.js +74 -27
- package/dist/lib/core/Driver/mariadb/MariadbDriver.js.map +1 -1
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.d.ts +45 -9
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.js +165 -21
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/mongodb/MongodbDriver.d.ts +24 -0
- package/dist/lib/core/Driver/mongodb/MongodbDriver.js +255 -0
- package/dist/lib/core/Driver/mongodb/MongodbDriver.js.map +1 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.d.ts +141 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.js +563 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.js.map +1 -0
- package/dist/lib/core/Driver/mysql/MysqlDriver.js +105 -95
- package/dist/lib/core/Driver/mysql/MysqlDriver.js.map +1 -1
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.d.ts +45 -9
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.js +165 -21
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/postgres/PostgresDriver.js +97 -72
- package/dist/lib/core/Driver/postgres/PostgresDriver.js.map +1 -1
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.d.ts +50 -9
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.js +296 -41
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/sqlite/SqliteDriver.d.ts +20 -0
- package/dist/lib/core/Driver/sqlite/SqliteDriver.js +192 -0
- package/dist/lib/core/Driver/sqlite/SqliteDriver.js.map +1 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.d.ts +144 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.js +689 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.js.map +1 -0
- package/dist/lib/core/JoinModel.js +2 -2
- package/dist/lib/core/JoinModel.js.map +1 -1
- package/dist/lib/core/Meta.d.ts +17 -11
- package/dist/lib/core/Meta.js +25 -19
- package/dist/lib/core/Meta.js.map +1 -1
- package/dist/lib/core/Model.d.ts +450 -108
- package/dist/lib/core/Model.js +1031 -587
- package/dist/lib/core/Model.js.map +1 -1
- package/dist/lib/{tools/index.d.ts → core/Package.d.ts} +11 -3
- package/dist/lib/{tools/index.js → core/Package.js} +20 -7
- package/dist/lib/core/Package.js.map +1 -0
- package/dist/lib/core/Pool.js +42 -30
- package/dist/lib/core/Pool.js.map +1 -1
- package/dist/lib/core/Queue.d.ts +240 -0
- package/dist/lib/core/Queue.js +686 -0
- package/dist/lib/core/Queue.js.map +1 -0
- package/dist/lib/core/RelationManager.js +27 -25
- package/dist/lib/core/RelationManager.js.map +1 -1
- package/dist/lib/core/Repository.d.ts +73 -207
- package/dist/lib/core/Repository.js +120 -235
- package/dist/lib/core/Repository.js.map +1 -1
- package/dist/lib/core/Schema.d.ts +218 -0
- package/dist/lib/core/Schema.js +370 -65
- package/dist/lib/core/Schema.js.map +1 -1
- package/dist/lib/core/StateManager.d.ts +25 -12
- package/dist/lib/core/StateManager.js +10 -5
- package/dist/lib/core/StateManager.js.map +1 -1
- package/dist/lib/core/UtilityTypes.d.ts +85 -56
- package/dist/lib/core/UtilityTypes.js.map +1 -1
- package/dist/lib/core/index.d.ts +4 -0
- package/dist/lib/core/index.js +6 -2
- package/dist/lib/core/index.js.map +1 -1
- package/dist/lib/types/decorator/index.d.ts +1 -1
- package/dist/lib/types/index.d.ts +69 -22
- package/dist/lib/types/repository/index.d.ts +68 -37
- package/dist/lib/utils/index.d.ts +11 -1
- package/dist/lib/utils/index.js +58 -2
- package/dist/lib/utils/index.js.map +1 -1
- package/package.json +14 -6
- package/dist/lib/tools/index.js.map +0 -1
|
@@ -1,55 +1,53 @@
|
|
|
1
|
+
import { TRawStringQuery } from "../types";
|
|
1
2
|
import { Model } from "./Model";
|
|
2
|
-
import type
|
|
3
|
+
import { type T } from "./UtilityTypes";
|
|
3
4
|
declare class RepositoryFactory<TS extends Record<string, any> = Record<string, any>, TR = unknown, M extends Model<TS, TR> = Model<TS, TR>> {
|
|
4
5
|
private _model;
|
|
5
6
|
constructor(_model: {
|
|
6
7
|
new (): Model<TS, TR>;
|
|
7
8
|
});
|
|
8
9
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* const user = await userRepository.findOne()
|
|
48
|
-
*/
|
|
49
|
-
first<K = {}, S extends T.SelectOptions<M> | undefined = undefined, SR extends T.RelationOptions<M> | undefined = undefined, E extends T.ExceptOptions<M> | undefined = undefined>(options?: T.RepositoryOptions<M, S, SR, E>): Promise<T.ResultFiltered<M, K, S, SR, E> | null>;
|
|
10
|
+
*
|
|
11
|
+
* The 'find' method is used to retrieve a single record from a database table by its primary key.
|
|
12
|
+
*
|
|
13
|
+
* It allows you to retrieve a single record from a database table that meets the specified criteria.
|
|
14
|
+
* @type {?Object} options
|
|
15
|
+
* @property {?object} options.select
|
|
16
|
+
* @property {?object} options.except
|
|
17
|
+
* @property {?object[]} options.orderBy
|
|
18
|
+
* @property {?string[]} options.groupBy
|
|
19
|
+
* @property {?string} options.having
|
|
20
|
+
* @property {?number} options.limit
|
|
21
|
+
* @property {?number} options.offset
|
|
22
|
+
* @property {?object} options.where
|
|
23
|
+
* @property {?string[]} options.whereRaw
|
|
24
|
+
* @property {?object} options.whereQuery
|
|
25
|
+
* @property {?{condition,callback}} options.when
|
|
26
|
+
* @property {?{localKey , referenceKey}[]} options.join
|
|
27
|
+
* @property {?{localKey , referenceKey}[]} options.rightJoin
|
|
28
|
+
* @property {?{localKey , referenceKey}[]} options.leftJoin
|
|
29
|
+
* @property {string[]} options.relations
|
|
30
|
+
* @property {string[]} options.relationExists
|
|
31
|
+
* @property {?{condition,callback}} options.relationQuery
|
|
32
|
+
* @property {?boolean} options.debug
|
|
33
|
+
* @returns {promise<Object | null>}
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* import { Repository } from 'tspace-mysql'
|
|
37
|
+
* import { User } from '../Models/User'
|
|
38
|
+
*
|
|
39
|
+
* const userRepository = Repository(User)
|
|
40
|
+
*
|
|
41
|
+
* const user = await userRepository.find(1,{
|
|
42
|
+
* select : { id: true, name: true }
|
|
43
|
+
* })
|
|
44
|
+
*
|
|
45
|
+
* const user = await userRepository.findOne()
|
|
46
|
+
*/
|
|
47
|
+
find<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 = {}>(primaryKey: number | string, options?: T.RepositoryOptions<M, S, SR, E, SRS, G>): Promise<T.ResultFiltered<M, S, SR, E, SRS, G> | null>;
|
|
50
48
|
/**
|
|
51
49
|
*
|
|
52
|
-
* The 'findOne' method is used to retrieve the
|
|
50
|
+
* The 'findOne' method is used to retrieve the first record that matches the query conditions.
|
|
53
51
|
*
|
|
54
52
|
* It allows you to retrieve a single record from a database table that meets the specified criteria.
|
|
55
53
|
* @type {?Object} options
|
|
@@ -88,10 +86,10 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
88
86
|
*
|
|
89
87
|
* const user = await userRepository.findOne()
|
|
90
88
|
*/
|
|
91
|
-
findOne<
|
|
89
|
+
findOne<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 = {}>(options?: T.RepositoryOptions<M, S, SR, E, SRS, G>): Promise<T.ResultFiltered<M, S, SR, E, SRS, G> | null>;
|
|
92
90
|
/**
|
|
93
91
|
*
|
|
94
|
-
* The '
|
|
92
|
+
* The 'findMany' method is used to retrieve the get record that matches the query conditions.
|
|
95
93
|
*
|
|
96
94
|
* It allows you to retrieve a single record from a database table that meets the specified criteria.
|
|
97
95
|
* @type {?Object} options
|
|
@@ -130,52 +128,10 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
130
128
|
*
|
|
131
129
|
* const users = await userRepository.get()
|
|
132
130
|
*/
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* The 'get' method is used to retrieve the get record that matches the query conditions.
|
|
137
|
-
*
|
|
138
|
-
* It allows you to retrieve a single record from a database table that meets the specified criteria.
|
|
139
|
-
* @type {?object} options
|
|
140
|
-
* @property {?object} options.select
|
|
141
|
-
* @property {?object} options.except
|
|
142
|
-
* @property {?object[]} options.orderBy
|
|
143
|
-
* @property {?string[]} options.groupBy
|
|
144
|
-
* @property {?string} options.having
|
|
145
|
-
* @property {?number} options.limit
|
|
146
|
-
* @property {?number} options.offset
|
|
147
|
-
* @property {?object} options.where
|
|
148
|
-
* @property {?string[]} options.whereRaw
|
|
149
|
-
* @property {?object} options.whereQuery
|
|
150
|
-
* @property {?{condition,callback}} options.when
|
|
151
|
-
* @property {?{localKey , referenceKey}[]} options.join
|
|
152
|
-
* @property {?{localKey , referenceKey}[]} options.rightJoin
|
|
153
|
-
* @property {?{localKey , referenceKey}[]} options.leftJoin
|
|
154
|
-
* @property {?string[]} options.relations
|
|
155
|
-
* @property {string[]} options.relationExists
|
|
156
|
-
* @property {?{condition,callback}} options.relationQuery
|
|
157
|
-
* @property {?boolean} options.debug
|
|
158
|
-
* @returns {promise<object>[]}
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* import { Repository } from 'tspace-mysql'
|
|
162
|
-
* import { User } from '../Models/User'
|
|
163
|
-
*
|
|
164
|
-
* const userRepository = Repository(User)
|
|
165
|
-
*
|
|
166
|
-
* const users = await userRepository.findMany({
|
|
167
|
-
* select : { id: true, name: true },
|
|
168
|
-
* where : {
|
|
169
|
-
* id: 1
|
|
170
|
-
* }
|
|
171
|
-
* })
|
|
172
|
-
*
|
|
173
|
-
* const users = await userRepository.findMany()
|
|
174
|
-
*/
|
|
175
|
-
findMany<K = {}, S extends T.SelectOptions<M> | undefined = undefined, SR extends T.RelationOptions<M> | undefined = undefined, E extends T.ExceptOptions<M> | undefined = undefined>(options?: T.RepositoryOptions<M, S, SR, E>): Promise<T.ResultFiltered<M, K, S, SR, E>[]>;
|
|
131
|
+
findMany<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 = {}>(options?: T.RepositoryOptions<M, S, SR, E, SRS, G>): Promise<T.ResultFiltered<M, S, SR, E, SRS, G>[]>;
|
|
176
132
|
/**
|
|
177
133
|
*
|
|
178
|
-
* The '
|
|
134
|
+
* The 'paginate' method is used to perform pagination on a set of database query results obtained through the Query Builder.
|
|
179
135
|
*
|
|
180
136
|
* It allows you to split a large set of query results into smaller, more manageable pages,
|
|
181
137
|
* making it easier to display data in a web application and improve user experience.
|
|
@@ -207,24 +163,22 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
207
163
|
*
|
|
208
164
|
* const userRepository = Repository(User)
|
|
209
165
|
*
|
|
210
|
-
* const users = await userRepository.
|
|
166
|
+
* const users = await userRepository.paginate({
|
|
211
167
|
* select : { id: true, name: true },
|
|
212
168
|
* where : {
|
|
213
169
|
* id: 1
|
|
214
170
|
* }
|
|
215
171
|
* })
|
|
216
172
|
*
|
|
217
|
-
* const users = await userRepository.
|
|
173
|
+
* const users = await userRepository.paginate({ page : 1 , limit : 2 })
|
|
218
174
|
*/
|
|
219
|
-
|
|
175
|
+
paginate<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 = {}>(options?: Omit<Partial<T.RepositoryOptions<M, S, SR, E, SRS, G>> & {
|
|
220
176
|
page?: number;
|
|
221
|
-
}): Promise<T.PaginateResultFiltered<M,
|
|
177
|
+
}, 'offset'>): Promise<T.PaginateResultFiltered<M, S, SR, E, SRS, G>>;
|
|
222
178
|
/**
|
|
179
|
+
* The 'exists' method is used to determine if any records exist in the database table that match the query conditions.
|
|
223
180
|
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* It allows you to split a large set of query results into smaller, more manageable pages,
|
|
227
|
-
* making it easier to display data in a web application and improve user experience
|
|
181
|
+
* It returns a boolean value indicating whether there are any matching records.
|
|
228
182
|
* @type {?object} options
|
|
229
183
|
* @property {?object} options.select
|
|
230
184
|
* @property {?object} options.except
|
|
@@ -240,12 +194,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
240
194
|
* @property {?{localKey , referenceKey}[]} options.join
|
|
241
195
|
* @property {?{localKey , referenceKey}[]} options.rightJoin
|
|
242
196
|
* @property {?{localKey , referenceKey}[]} options.leftJoin
|
|
243
|
-
* @property {?string[]} options.relations
|
|
244
|
-
* @property {string[]} options.relationExists
|
|
245
|
-
* @property {?{condition,callback}} options.relationQuery
|
|
246
197
|
* @property {?boolean} options.debug
|
|
247
|
-
* @property {?number} options.page
|
|
248
|
-
* @returns {promise<{ meta , data[]}>}
|
|
249
198
|
*
|
|
250
199
|
* @example
|
|
251
200
|
* import { Repository } from 'tspace-mysql'
|
|
@@ -253,39 +202,12 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
253
202
|
*
|
|
254
203
|
* const userRepository = Repository(User)
|
|
255
204
|
*
|
|
256
|
-
* const users = await userRepository.
|
|
257
|
-
* select : { id: true, name: true },
|
|
205
|
+
* const users = await userRepository.exists({
|
|
258
206
|
* where : {
|
|
259
207
|
* id: 1
|
|
260
208
|
* }
|
|
261
209
|
* })
|
|
262
210
|
*
|
|
263
|
-
* const users = await userRepository.paginate({ page : 1 , limit : 2 })
|
|
264
|
-
*/
|
|
265
|
-
paginate<K = {}, S extends T.SelectOptions<M> | undefined = undefined, SR extends T.RelationOptions<M> | undefined = undefined, E extends T.ExceptOptions<M> | undefined = undefined>(options?: Partial<T.RepositoryOptions<M, S, SR, E>> & {
|
|
266
|
-
page?: number;
|
|
267
|
-
}): Promise<T.PaginateResultFiltered<M, K, S, SR, E>>;
|
|
268
|
-
/**
|
|
269
|
-
* The 'exists' method is used to determine if any records exist in the database table that match the query conditions.
|
|
270
|
-
*
|
|
271
|
-
* It returns a boolean value indicating whether there are any matching records.
|
|
272
|
-
* @type {?object} options
|
|
273
|
-
* @property {?object} options.select
|
|
274
|
-
* @property {?object} options.except
|
|
275
|
-
* @property {?object[]} options.orderBy
|
|
276
|
-
* @property {?string[]} options.groupBy
|
|
277
|
-
* @property {?string} options.having
|
|
278
|
-
* @property {?number} options.limit
|
|
279
|
-
* @property {?number} options.offset
|
|
280
|
-
* @property {?object} options.where
|
|
281
|
-
* @property {?string[]} options.whereRaw
|
|
282
|
-
* @property {?object} options.whereQuery
|
|
283
|
-
* @property {?{condition,callback}} options.when
|
|
284
|
-
* @property {?{localKey , referenceKey}[]} options.join
|
|
285
|
-
* @property {?{localKey , referenceKey}[]} options.rightJoin
|
|
286
|
-
* @property {?{localKey , referenceKey}[]} options.leftJoin
|
|
287
|
-
* @property {?boolean} options.debug
|
|
288
|
-
* @property {?number} options.page
|
|
289
211
|
*/
|
|
290
212
|
exists(options: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<boolean>;
|
|
291
213
|
/**
|
|
@@ -308,7 +230,6 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
308
230
|
* @property {?{localKey , referenceKey}[]} options.rightJoin
|
|
309
231
|
* @property {?{localKey , referenceKey}[]} options.leftJoin
|
|
310
232
|
* @property {?boolean} options.debug
|
|
311
|
-
* @property {?number} options.page
|
|
312
233
|
* @returns {string}
|
|
313
234
|
*/
|
|
314
235
|
toString(options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): string;
|
|
@@ -364,7 +285,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
364
285
|
* @property {?number} options.page
|
|
365
286
|
* @return {promise<any[]>}
|
|
366
287
|
*/
|
|
367
|
-
toArray
|
|
288
|
+
toArray<K extends T.ColumnKeys<M> | `${string}.${string}`>(column: K, options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<(K extends keyof T.Result<M> ? T.Result<M>[K] : unknown)[]>;
|
|
368
289
|
/**
|
|
369
290
|
* The 'count' method is used to retrieve the total number of records that match the specified query conditions.
|
|
370
291
|
*
|
|
@@ -389,7 +310,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
389
310
|
* @property {?number} options.page
|
|
390
311
|
* @return {promise<any[]>}
|
|
391
312
|
*/
|
|
392
|
-
count(column:
|
|
313
|
+
count(column: T.ColumnKeys<M> | `${string}.${string}`, options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<number>;
|
|
393
314
|
/**
|
|
394
315
|
* The 'avg' method is used to retrieve the total number of records that match the specified query conditions.
|
|
395
316
|
*
|
|
@@ -414,7 +335,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
414
335
|
* @property {?number} options.page
|
|
415
336
|
* @return {promise<any[]>}
|
|
416
337
|
*/
|
|
417
|
-
avg(column:
|
|
338
|
+
avg(column: T.ColumnKeys<M> | `${string}.${string}`, options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<number>;
|
|
418
339
|
/**
|
|
419
340
|
* The 'sum' method is used to retrieve the total number of records that match the specified query conditions.
|
|
420
341
|
*
|
|
@@ -439,7 +360,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
439
360
|
* @property {?number} options.page
|
|
440
361
|
* @return {promise<any[]>}
|
|
441
362
|
*/
|
|
442
|
-
sum(column:
|
|
363
|
+
sum(column: T.ColumnKeys<M> | `${string}.${string}`, options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<number>;
|
|
443
364
|
/**
|
|
444
365
|
* The 'max' method is used to retrieve the maximum value of a numeric column in a database table.
|
|
445
366
|
*
|
|
@@ -464,7 +385,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
464
385
|
* @property {?number} options.page
|
|
465
386
|
* @return {promise<any[]>}
|
|
466
387
|
*/
|
|
467
|
-
max(column:
|
|
388
|
+
max(column: T.ColumnKeys<M> | `${string}.${string}`, options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<number>;
|
|
468
389
|
/**
|
|
469
390
|
* The 'min' method is used to retrieve the minimum (lowest) value of a numeric column in a database table.
|
|
470
391
|
*
|
|
@@ -489,7 +410,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
489
410
|
* @property {?number} options.page
|
|
490
411
|
* @return {promise<any[]>}
|
|
491
412
|
*/
|
|
492
|
-
min(column:
|
|
413
|
+
min(column: T.ColumnKeys<M> | `${string}.${string}`, options?: Partial<Omit<T.RepositoryOptions<M>, "relations" | "relationQuery">>): Promise<number>;
|
|
493
414
|
/**
|
|
494
415
|
* The 'create' method is used to insert a new record into a database table associated.
|
|
495
416
|
*
|
|
@@ -498,20 +419,9 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
498
419
|
* @property {object} options.data
|
|
499
420
|
* @property {?boolean} options.debug
|
|
500
421
|
* @property {?transaction} options.transaction
|
|
501
|
-
* @return {promise<
|
|
502
|
-
*/
|
|
503
|
-
create({ data, debug, transaction, }: T.RepositoryCreate<M>): Promise<T.Result<M>>;
|
|
504
|
-
/**
|
|
505
|
-
* The 'insert' method is used to insert a new record into a database table associated.
|
|
506
|
-
*
|
|
507
|
-
* It simplifies the process of creating and inserting records.
|
|
508
|
-
* @type {object} options
|
|
509
|
-
* @property {object} options.data
|
|
510
|
-
* @property {?boolean} options.debug
|
|
511
|
-
* @property {?transaction} options.transaction
|
|
512
|
-
* @return {promise<TS>}
|
|
422
|
+
* @return {promise<T.Result<M>>}
|
|
513
423
|
*/
|
|
514
|
-
|
|
424
|
+
create<NR extends boolean | undefined = false>({ data, debug, transaction, noReturn, }: T.RepositoryCreate<M, NR>): Promise<NR extends true ? undefined : T.Result<M>>;
|
|
515
425
|
/**
|
|
516
426
|
* The 'createNotExists' method to insert data into a database table while ignoring any duplicate key constraint violations.
|
|
517
427
|
*
|
|
@@ -525,21 +435,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
525
435
|
* @property {?transaction} options.transaction
|
|
526
436
|
* @return {promise<T | null>}
|
|
527
437
|
*/
|
|
528
|
-
createNotExists({ data, where, debug, }: T.RepositoryCreateOrThings<M>): Promise<T.Result<M> | null>;
|
|
529
|
-
/**
|
|
530
|
-
* The 'insertNotExists' method to insert data into a database table while ignoring any duplicate key constraint violations.
|
|
531
|
-
*
|
|
532
|
-
* This method is particularly useful when you want to insert records into a table and ensure that duplicates are not inserted,
|
|
533
|
-
* but without raising an error or exception if duplicates are encountered.
|
|
534
|
-
*
|
|
535
|
-
* @type {object} options
|
|
536
|
-
* @property {object} options.data
|
|
537
|
-
* @property {object} options.where
|
|
538
|
-
* @property {?boolean} options.debug
|
|
539
|
-
* @property {?transaction} options.transaction
|
|
540
|
-
* @return {promise<T | null>}
|
|
541
|
-
*/
|
|
542
|
-
insertNotExists({ data, where, debug, }: T.RepositoryCreateOrThings<M>): Promise<T.Result<M> | null>;
|
|
438
|
+
createNotExists<NR extends boolean | undefined = false>({ data, where, debug, noReturn, transaction }: T.RepositoryCreateOrThings<M, NR>): Promise<NR extends true ? undefined : T.Result<M> | null>;
|
|
543
439
|
/**
|
|
544
440
|
* The 'createMultiple' method is used to insert a new records into a database table associated.
|
|
545
441
|
*
|
|
@@ -550,9 +446,9 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
550
446
|
* @property {?transaction} options.transaction
|
|
551
447
|
* @return {promise<TS[]>}
|
|
552
448
|
*/
|
|
553
|
-
createMultiple({ data, debug, transaction, }: T.RepositoryCreateMultiple<M>): Promise<T.Result<M>[]>;
|
|
449
|
+
createMultiple<NR extends boolean | undefined = false>({ data, debug, transaction, noReturn }: T.RepositoryCreateMultiple<M, NR>): Promise<NR extends true ? undefined : T.Result<M>[]>;
|
|
554
450
|
/**
|
|
555
|
-
* The '
|
|
451
|
+
* The 'createMany' method is used to insert a new records into a database table associated.
|
|
556
452
|
*
|
|
557
453
|
* It simplifies the process of creating and inserting records with an array.
|
|
558
454
|
* @type {object} options
|
|
@@ -561,7 +457,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
561
457
|
* @property {?transaction} options.transaction
|
|
562
458
|
* @return {promise<TS[]>}
|
|
563
459
|
*/
|
|
564
|
-
|
|
460
|
+
createMany<NR extends boolean | undefined = false>({ data, debug, transaction, noReturn }: T.RepositoryCreateMultiple<M, NR>): Promise<NR extends true ? undefined : T.Result<M>[]>;
|
|
565
461
|
/**
|
|
566
462
|
*
|
|
567
463
|
* The 'createOrUpdate' method allows you to update an existing record in a database table if it exists or create a new record if it does not exist.
|
|
@@ -572,22 +468,9 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
572
468
|
* @property {object} options.data
|
|
573
469
|
* @property {object} options.where
|
|
574
470
|
* @property {?boolean} options.debug
|
|
575
|
-
* @return {promise<
|
|
576
|
-
*/
|
|
577
|
-
createOrUpdate({ data, where, debug, }: T.RepositoryCreateOrThings<M>): Promise<T.Result<M>>;
|
|
578
|
-
/**
|
|
579
|
-
*
|
|
580
|
-
* The 'insertOrUpdate' method allows you to update an existing record in a database table if it exists or create a new record if it does not exist.
|
|
581
|
-
*
|
|
582
|
-
* This method is particularly useful when you want to update a record based on certain conditions and,
|
|
583
|
-
* if the record matching those conditions doesn't exist, create a new one with the provided data.
|
|
584
|
-
* @type {object} options
|
|
585
|
-
* @property {object} options.data
|
|
586
|
-
* @property {object} options.where
|
|
587
|
-
* @property {?boolean} options.debug
|
|
588
|
-
* @return {promise<TS>}
|
|
471
|
+
* @return {promise<T.Result<M>>}
|
|
589
472
|
*/
|
|
590
|
-
|
|
473
|
+
createOrUpdate<NR extends boolean | undefined = false>({ data, where, debug, transaction, noReturn }: T.RepositoryCreateOrThings<M, NR>): Promise<NR extends true ? undefined : T.Result<M>>;
|
|
591
474
|
/**
|
|
592
475
|
*
|
|
593
476
|
* The 'createOrSelect' method to insert data into a database table while select any duplicate key constraint violations.
|
|
@@ -598,23 +481,9 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
598
481
|
* @property {object} options.data
|
|
599
482
|
* @property {object} options.where
|
|
600
483
|
* @property {?boolean} options.debug
|
|
601
|
-
* @return {promise<
|
|
602
|
-
*/
|
|
603
|
-
createOrSelect({ data, where, debug, }: T.RepositoryCreateOrThings<M>): Promise<T.Result<M>>;
|
|
604
|
-
/**
|
|
605
|
-
*
|
|
606
|
-
* The 'insertOrSelect' method to insert data into a database table while select any duplicate key constraint violations.
|
|
607
|
-
*
|
|
608
|
-
* This method is particularly useful when you want to insert records into a table and ensure that duplicates are not inserted,
|
|
609
|
-
* but if exists should be returns a result.
|
|
610
|
-
* @type {object} options
|
|
611
|
-
* @property {object} options.data
|
|
612
|
-
* @property {object} options.where
|
|
613
|
-
* @property {?boolean} options.debug
|
|
614
|
-
* @property {?transaction} options.transaction
|
|
615
|
-
* @return {promise<TS>}
|
|
484
|
+
* @return {promise<T.Result<M>>}
|
|
616
485
|
*/
|
|
617
|
-
|
|
486
|
+
createOrSelect<NR extends boolean | undefined = false>({ data, where, debug, transaction, noReturn }: T.RepositoryCreateOrThings<M, NR>): Promise<NR extends true ? undefined : T.Result<M> | null>;
|
|
618
487
|
/**
|
|
619
488
|
* The 'update' method is used to update existing records in a database table that are associated.
|
|
620
489
|
*
|
|
@@ -626,9 +495,9 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
626
495
|
* @property {object} options.where
|
|
627
496
|
* @property {?boolean} options.debug
|
|
628
497
|
* @property {?transaction} options.transaction
|
|
629
|
-
* @return {promise<
|
|
498
|
+
* @return {promise<T.Result<M>>}
|
|
630
499
|
*/
|
|
631
|
-
update({ data, where, debug, transaction, }: T.RepositoryUpdate<M>): Promise<T.Result<M
|
|
500
|
+
update<NR extends boolean | undefined = false>({ data, where, debug, transaction, noReturn }: T.RepositoryUpdate<M, NR>): Promise<NR extends true ? undefined : T.Result<M> | null>;
|
|
632
501
|
/**
|
|
633
502
|
* The 'updateMany' method is used to update existing records in a database table that are associated.
|
|
634
503
|
*
|
|
@@ -640,9 +509,9 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
640
509
|
* @property {object} options.where
|
|
641
510
|
* @property {?boolean} options.debug
|
|
642
511
|
* @property {?transaction} options.transaction
|
|
643
|
-
* @return {promise<
|
|
512
|
+
* @return {promise<T.Result<M>[]>}
|
|
644
513
|
*/
|
|
645
|
-
updateMany({ data, where, debug, transaction, }: T.RepositoryUpdate<M>): Promise<T.Result<M>[]>;
|
|
514
|
+
updateMany<NR extends boolean | undefined = false>({ data, where, debug, transaction, noReturn }: T.RepositoryUpdate<M, NR>): Promise<NR extends true ? undefined : T.Result<M>[]>;
|
|
646
515
|
/**
|
|
647
516
|
* The 'updateCases' method is used to update records in a table based on specific conditions.
|
|
648
517
|
*
|
|
@@ -681,7 +550,7 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
681
550
|
* })
|
|
682
551
|
*
|
|
683
552
|
*/
|
|
684
|
-
updateCases({ cases, debug, transaction, }: T.RepositoryUpdateMultiple<M>): Promise<T.Result<M>[]>;
|
|
553
|
+
updateCases<NR extends boolean | undefined = false>({ cases, debug, transaction, noReturn }: T.RepositoryUpdateMultiple<M, NR>): Promise<NR extends true ? undefined : T.Result<M>[]>;
|
|
685
554
|
/**
|
|
686
555
|
* The 'delete' method is used to delete records from a database table based on the specified query conditions.
|
|
687
556
|
*
|
|
@@ -715,9 +584,6 @@ declare class RepositoryFactory<TS extends Record<string, any> = Record<string,
|
|
|
715
584
|
*
|
|
716
585
|
* It provides methods for querying, inserting, updating, and deleting records in the database associated with the model.
|
|
717
586
|
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
* The 'bind' method is used to bind the model to the repository
|
|
721
587
|
* @param {Model} model A class constructor for a model
|
|
722
588
|
* @returns {RepositoryFactory<T,R>}
|
|
723
589
|
*
|