@platformatic/sql-mapper 1.33.0 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mapper.d.ts +28 -2
- package/package.json +3 -3
package/mapper.d.ts
CHANGED
|
@@ -74,11 +74,11 @@ export interface WhereCondition {
|
|
|
74
74
|
/**
|
|
75
75
|
* Equal to value.
|
|
76
76
|
*/
|
|
77
|
-
eq?: string,
|
|
77
|
+
eq?: string | null,
|
|
78
78
|
/**
|
|
79
79
|
* Not equal to value.
|
|
80
80
|
*/
|
|
81
|
-
neq?: string,
|
|
81
|
+
neq?: string | null,
|
|
82
82
|
/**
|
|
83
83
|
* Greater than value.
|
|
84
84
|
*/
|
|
@@ -227,6 +227,27 @@ interface Delete<EntityFields> {
|
|
|
227
227
|
}): Promise<Partial<EntityFields>[]>,
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
interface UpdateMany<EntityFields> {
|
|
231
|
+
(options: {
|
|
232
|
+
/**
|
|
233
|
+
* SQL where condition.
|
|
234
|
+
*/
|
|
235
|
+
where: WhereCondition,
|
|
236
|
+
/**
|
|
237
|
+
* Entity fields to update.
|
|
238
|
+
*/
|
|
239
|
+
input: EntityFields,
|
|
240
|
+
/**
|
|
241
|
+
* List of fields to be returned for each object
|
|
242
|
+
*/
|
|
243
|
+
fields?: string[],
|
|
244
|
+
/**
|
|
245
|
+
* If present, the entity participates in transaction
|
|
246
|
+
*/
|
|
247
|
+
tx?: Database
|
|
248
|
+
}): Promise<Partial<EntityFields>[]>
|
|
249
|
+
}
|
|
250
|
+
|
|
230
251
|
export interface Entity<EntityFields = any> {
|
|
231
252
|
/**
|
|
232
253
|
* The origin name of the database entity.
|
|
@@ -288,6 +309,10 @@ export interface Entity<EntityFields = any> {
|
|
|
288
309
|
* Count the entities considering the where condition.
|
|
289
310
|
*/
|
|
290
311
|
count: Count,
|
|
312
|
+
/**
|
|
313
|
+
* Update one or more entity rows from the database.
|
|
314
|
+
*/
|
|
315
|
+
updateMany: UpdateMany<EntityFields>
|
|
291
316
|
}
|
|
292
317
|
|
|
293
318
|
type EntityHook<T extends (...args: any) => any> = (original: T, ...options: Parameters<T>) => ReturnType<T>;
|
|
@@ -298,6 +323,7 @@ export interface EntityHooks<EntityFields = any> {
|
|
|
298
323
|
save?: EntityHook<Save<EntityFields>>,
|
|
299
324
|
delete?: EntityHook<Delete<EntityFields>>,
|
|
300
325
|
count?: EntityHook<Count>,
|
|
326
|
+
updateMany?: EntityHook<UpdateMany<EntityFields>>
|
|
301
327
|
}
|
|
302
328
|
|
|
303
329
|
interface BasePoolOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/sql-mapper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"description": "A data mapper utility for SQL databases",
|
|
5
5
|
"main": "mapper.js",
|
|
6
6
|
"types": "mapper.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@matteo.collina/tspl": "^0.1.1",
|
|
19
|
-
"borp": "^0.
|
|
19
|
+
"borp": "^0.11.0",
|
|
20
20
|
"fastify": "^4.26.2",
|
|
21
21
|
"snazzy": "^9.0.0",
|
|
22
22
|
"standard": "^17.1.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"camelcase": "^6.3.0",
|
|
34
34
|
"fastify-plugin": "^4.5.1",
|
|
35
35
|
"inflected": "^2.1.0",
|
|
36
|
-
"@platformatic/utils": "1.
|
|
36
|
+
"@platformatic/utils": "1.35.0"
|
|
37
37
|
},
|
|
38
38
|
"tsd": {
|
|
39
39
|
"directory": "test/types"
|