drizzle-orm 0.10.4 → 0.10.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.
- package/mappers/responseMapper.js +2 -2
- package/package.json +1 -1
- package/test.js +11 -13
|
@@ -13,7 +13,7 @@ QueryResponseMapper.map = (mappedServiceToDb, queryResult, joinId) => {
|
|
|
13
13
|
const column = mappedServiceToDb[key];
|
|
14
14
|
const alias = `${column.getAlias()}${joinId ? `_${joinId}` : ''}`;
|
|
15
15
|
const value = column.getColumnType().selectStrategy(row[alias]);
|
|
16
|
-
mappedRow[key] = value;
|
|
16
|
+
mappedRow[key] = value === null ? undefined : value;
|
|
17
17
|
});
|
|
18
18
|
response.push(mappedRow);
|
|
19
19
|
});
|
|
@@ -27,7 +27,7 @@ QueryResponseMapper.partialMap = (partial, queryResult, joinId) => {
|
|
|
27
27
|
const column = partial[key];
|
|
28
28
|
const alias = `${column.getAlias()}${joinId ? `_${joinId}` : ''}`;
|
|
29
29
|
const value = column.getColumnType().selectStrategy(row[alias]);
|
|
30
|
-
mappedRow[key] = value;
|
|
30
|
+
mappedRow[key] = value === null ? undefined : value;
|
|
31
31
|
});
|
|
32
32
|
response.push(mappedRow);
|
|
33
33
|
});
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const _1 = require(".");
|
|
4
|
-
const builders_1 = require("./builders");
|
|
5
4
|
const citiesTable_1 = require("./docs/tables/citiesTable");
|
|
6
5
|
const usersTable_1 = require("./docs/tables/usersTable");
|
|
7
6
|
const consoleLogger_1 = require("./logger/consoleLogger");
|
|
@@ -27,18 +26,17 @@ const fromTypeFile = (filepath) => {
|
|
|
27
26
|
db.useLogger(new consoleLogger_1.default());
|
|
28
27
|
const table = new usersTable_1.default(db);
|
|
29
28
|
const citiesTable = new citiesTable_1.default(db);
|
|
30
|
-
const res = await table.
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// });
|
|
29
|
+
// const res = await table.insert({
|
|
30
|
+
// decimalField: 12.4,
|
|
31
|
+
// createdAt: new Date(),
|
|
32
|
+
// }).all();
|
|
33
|
+
// console.log(res);
|
|
34
|
+
const res1 = await citiesTable.select().leftJoin(usersTable_1.default, (cities) => cities.userId, (users) => users.id).execute();
|
|
35
|
+
// eslint-disable-next-line array-callback-return
|
|
36
|
+
res1.map((city, user) => {
|
|
37
|
+
console.log(city);
|
|
38
|
+
console.log(user.decimalField);
|
|
39
|
+
});
|
|
42
40
|
// await table.insertMany([{
|
|
43
41
|
// decimalField: 12.4,
|
|
44
42
|
// createdAt: new Date(),
|