dbgate-sqltree 5.0.3 → 5.0.4-alpha.2
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/dumpSqlExpression.js +8 -2
- package/lib/evaluateExpression.js +2 -0
- package/lib/types.d.ts +7 -1
- package/package.json +2 -2
package/lib/dumpSqlExpression.js
CHANGED
|
@@ -30,16 +30,22 @@ function dumpSqlExpression(dmp, expr) {
|
|
|
30
30
|
dmp.putCollection(',', expr.args, x => dumpSqlExpression(dmp, x));
|
|
31
31
|
dmp.put(')');
|
|
32
32
|
break;
|
|
33
|
+
case 'methodCall':
|
|
34
|
+
dumpSqlExpression(dmp, expr.thisObject);
|
|
35
|
+
dmp.put('.%s(', expr.method);
|
|
36
|
+
dmp.putCollection(',', expr.args, x => dumpSqlExpression(dmp, x));
|
|
37
|
+
dmp.put(')');
|
|
38
|
+
break;
|
|
33
39
|
case 'transform':
|
|
34
40
|
dmp.transform(expr.transform, () => dumpSqlExpression(dmp, expr.expr));
|
|
35
41
|
break;
|
|
36
42
|
case 'rowNumber':
|
|
37
|
-
dmp.put(
|
|
43
|
+
dmp.put(' ^row_number() ^over (^order ^by ');
|
|
38
44
|
dmp.putCollection(', ', expr.orderBy, x => {
|
|
39
45
|
dumpSqlExpression(dmp, x);
|
|
40
46
|
dmp.put(' %k', x.direction);
|
|
41
47
|
});
|
|
42
|
-
dmp.put(
|
|
48
|
+
dmp.put(')');
|
|
43
49
|
break;
|
|
44
50
|
}
|
|
45
51
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -113,6 +113,12 @@ export interface CallExpression {
|
|
|
113
113
|
args: Expression[];
|
|
114
114
|
argsPrefix?: string;
|
|
115
115
|
}
|
|
116
|
+
export interface MethodCallExpression {
|
|
117
|
+
exprType: 'methodCall';
|
|
118
|
+
method: string;
|
|
119
|
+
args: Expression[];
|
|
120
|
+
thisObject: Expression;
|
|
121
|
+
}
|
|
116
122
|
export interface TranformExpression {
|
|
117
123
|
exprType: 'transform';
|
|
118
124
|
expr: Expression;
|
|
@@ -122,7 +128,7 @@ export interface RowNumberExpression {
|
|
|
122
128
|
exprType: 'rowNumber';
|
|
123
129
|
orderBy: OrderByExpression[];
|
|
124
130
|
}
|
|
125
|
-
export declare type Expression = ColumnRefExpression | ValueExpression | PlaceholderExpression | RawExpression | CallExpression | TranformExpression | RowNumberExpression;
|
|
131
|
+
export declare type Expression = ColumnRefExpression | ValueExpression | PlaceholderExpression | RawExpression | CallExpression | MethodCallExpression | TranformExpression | RowNumberExpression;
|
|
126
132
|
export declare type OrderByExpression = Expression & {
|
|
127
133
|
direction: 'ASC' | 'DESC';
|
|
128
134
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.0.
|
|
2
|
+
"version": "5.0.4-alpha.2",
|
|
3
3
|
"name": "dbgate-sqltree",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^13.7.0",
|
|
30
|
-
"dbgate-types": "^5.0.
|
|
30
|
+
"dbgate-types": "^5.0.4-alpha.2",
|
|
31
31
|
"typescript": "^4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|