dbgate-filterparser 5.5.4-alpha.8 → 5.5.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/lib/filterTool.js +9 -2
- package/package.json +4 -3
package/lib/filterTool.js
CHANGED
|
@@ -5,12 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createMultiLineFilter = exports.getFilterValueExpression = void 0;
|
|
7
7
|
const dbgate_tools_1 = require("dbgate-tools");
|
|
8
|
-
const
|
|
8
|
+
const date_fns_1 = require("date-fns");
|
|
9
|
+
const isString_1 = __importDefault(require("lodash/isString"));
|
|
10
|
+
function getDateStringWithoutTimeZone(dateString) {
|
|
11
|
+
if ((0, isString_1.default)(dateString)) {
|
|
12
|
+
return dateString.replace(/Z|([+-]\d{2}:\d{2})$/, '');
|
|
13
|
+
}
|
|
14
|
+
return dateString;
|
|
15
|
+
}
|
|
9
16
|
function getFilterValueExpression(value, dataType) {
|
|
10
17
|
if (value == null)
|
|
11
18
|
return 'NULL';
|
|
12
19
|
if ((0, dbgate_tools_1.isTypeDateTime)(dataType))
|
|
13
|
-
return (0,
|
|
20
|
+
return (0, date_fns_1.format)((0, date_fns_1.toDate)(getDateStringWithoutTimeZone(value)), 'yyyy-MM-dd HH:mm:ss');
|
|
14
21
|
if (value === true)
|
|
15
22
|
return 'TRUE';
|
|
16
23
|
if (value === false)
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.5.
|
|
2
|
+
"version": "5.5.5",
|
|
3
3
|
"name": "dbgate-filterparser",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lib"
|
|
14
14
|
],
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"dbgate-types": "^5.5.
|
|
16
|
+
"dbgate-types": "^5.5.5",
|
|
17
17
|
"@types/jest": "^25.1.4",
|
|
18
18
|
"@types/node": "^13.7.0",
|
|
19
19
|
"jest": "^28.1.3",
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@types/parsimmon": "^1.10.1",
|
|
25
|
-
"dbgate-tools": "^5.5.
|
|
25
|
+
"dbgate-tools": "^5.5.5",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
|
+
"date-fns": "^4.1.0",
|
|
27
28
|
"moment": "^2.24.0",
|
|
28
29
|
"parsimmon": "^1.13.0"
|
|
29
30
|
}
|