@snowtop/ent 0.1.0-alpha78 → 0.1.0-alpha79
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/core/clause.js +14 -2
- package/package.json +1 -1
- package/testutils/db_time_zone.d.ts +4 -0
- package/testutils/db_time_zone.js +41 -0
package/core/clause.js
CHANGED
|
@@ -184,9 +184,9 @@ class postgresArrayOperator {
|
|
|
184
184
|
}
|
|
185
185
|
logValues() {
|
|
186
186
|
if (isSensitive(this.value)) {
|
|
187
|
-
return [this.value.logValue()];
|
|
187
|
+
return [`{${this.value.logValue()}}`];
|
|
188
188
|
}
|
|
189
|
-
return [this.value];
|
|
189
|
+
return [`{${this.value}}`];
|
|
190
190
|
}
|
|
191
191
|
instanceKey() {
|
|
192
192
|
if (this.not) {
|
|
@@ -211,6 +211,18 @@ class postgresArrayOperatorList extends postgresArrayOperator {
|
|
|
211
211
|
.join(", ")}}`,
|
|
212
212
|
];
|
|
213
213
|
}
|
|
214
|
+
logValues() {
|
|
215
|
+
return [
|
|
216
|
+
`{${this.value
|
|
217
|
+
.map((v) => {
|
|
218
|
+
if (isSensitive(v)) {
|
|
219
|
+
return v.logValue();
|
|
220
|
+
}
|
|
221
|
+
return v;
|
|
222
|
+
})
|
|
223
|
+
.join(", ")}}`,
|
|
224
|
+
];
|
|
225
|
+
}
|
|
214
226
|
}
|
|
215
227
|
class inClause {
|
|
216
228
|
constructor(col, value, type = "uuid") {
|
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DBTimeZone = void 0;
|
|
7
|
+
const luxon_1 = require("luxon");
|
|
8
|
+
const schema_1 = require("../schema");
|
|
9
|
+
const db_1 = __importDefault(require("../core/db"));
|
|
10
|
+
let dbCurrentZone = undefined;
|
|
11
|
+
class DBTimeZone {
|
|
12
|
+
static async getVal() {
|
|
13
|
+
if (dbCurrentZone !== undefined) {
|
|
14
|
+
return dbCurrentZone;
|
|
15
|
+
}
|
|
16
|
+
const r = await db_1.default.getInstance()
|
|
17
|
+
.getPool()
|
|
18
|
+
.query("SELECT current_setting('TIMEZONE');");
|
|
19
|
+
if (r.rows.length) {
|
|
20
|
+
dbCurrentZone = r.rows[0].current_setting;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
dbCurrentZone = null;
|
|
24
|
+
}
|
|
25
|
+
return dbCurrentZone;
|
|
26
|
+
}
|
|
27
|
+
static async getDateOffset(d) {
|
|
28
|
+
let zone = await DBTimeZone.getVal();
|
|
29
|
+
let dt = luxon_1.DateTime.fromJSDate(d);
|
|
30
|
+
if (zone) {
|
|
31
|
+
dt = dt.setZone(zone);
|
|
32
|
+
}
|
|
33
|
+
// use
|
|
34
|
+
const val = (0, schema_1.leftPad)(dt.get("offset") / 60);
|
|
35
|
+
if (val == "00") {
|
|
36
|
+
return "+00";
|
|
37
|
+
}
|
|
38
|
+
return val;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.DBTimeZone = DBTimeZone;
|