prettier-plugin-sql-cst 0.9.2 → 0.10.1
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/README.md +15 -0
- package/dist/embedJson.js +2 -1
- package/dist/index.js +18 -0
- package/dist/node_utils.d.ts +1 -0
- package/dist/node_utils.js +2 -1
- package/dist/syntax/alias.js +1 -1
- package/dist/syntax/alter_table.d.ts +1 -1
- package/dist/syntax/base.d.ts +1 -1
- package/dist/syntax/constraint.d.ts +1 -1
- package/dist/syntax/constraint.js +14 -1
- package/dist/syntax/create_table.d.ts +1 -1
- package/dist/syntax/create_table.js +11 -1
- package/dist/syntax/data_type.d.ts +1 -1
- package/dist/syntax/data_type.js +5 -0
- package/dist/syntax/dcl.d.ts +1 -1
- package/dist/syntax/delete.js +3 -1
- package/dist/syntax/dialects/bigquery.d.ts +3 -0
- package/dist/syntax/{bigquery.js → dialects/bigquery.js} +1 -1
- package/dist/syntax/dialects/mysql.d.ts +3 -0
- package/dist/syntax/dialects/mysql.js +6 -0
- package/dist/syntax/dialects/postgresql.d.ts +3 -0
- package/dist/syntax/dialects/postgresql.js +7 -0
- package/dist/syntax/{sqlite.d.ts → dialects/sqlite.d.ts} +1 -1
- package/dist/syntax/{sqlite.js → dialects/sqlite.js} +1 -1
- package/dist/syntax/expr.d.ts +1 -1
- package/dist/syntax/expr.js +22 -1
- package/dist/syntax/function.d.ts +1 -1
- package/dist/syntax/index.d.ts +1 -1
- package/dist/syntax/insert.d.ts +1 -1
- package/dist/syntax/insert.js +14 -23
- package/dist/syntax/merge.d.ts +1 -1
- package/dist/syntax/prepared_statements.d.ts +1 -1
- package/dist/syntax/proc_clause.d.ts +1 -1
- package/dist/syntax/procedural_language.d.ts +1 -1
- package/dist/syntax/procedure.d.ts +1 -1
- package/dist/syntax/schema.d.ts +1 -1
- package/dist/syntax/select.d.ts +1 -1
- package/dist/syntax/select.js +177 -11
- package/dist/syntax/transformMap.js +5 -3
- package/dist/syntax/trigger.d.ts +1 -1
- package/dist/syntax/update.d.ts +1 -1
- package/dist/syntax/update.js +1 -1
- package/dist/syntax/view.d.ts +1 -1
- package/package.json +4 -3
- package/dist/syntax/bigquery.d.ts +0 -3
package/README.md
CHANGED
|
@@ -89,6 +89,9 @@ The plugin provides the following parsers:
|
|
|
89
89
|
|
|
90
90
|
- `sqlite`
|
|
91
91
|
- `bigquery`
|
|
92
|
+
- `postgresql` (**experimental! expect crashes**)
|
|
93
|
+
- `mysql` (**experimental! expect crashes**)
|
|
94
|
+
- `mariadb` (**experimental! expect crashes**)
|
|
92
95
|
|
|
93
96
|
## Configuration
|
|
94
97
|
|
|
@@ -107,6 +110,18 @@ Currently this plugin supports two SQL dialects:
|
|
|
107
110
|
- **SQLite** - full support.
|
|
108
111
|
- **BigQuery** - full support.
|
|
109
112
|
|
|
113
|
+
It also has experimental support for the following dialects:
|
|
114
|
+
|
|
115
|
+
- PostgreSQL
|
|
116
|
+
- MySQL
|
|
117
|
+
- MariaDB
|
|
118
|
+
|
|
119
|
+
The main limitation is that [the parser][sql-parser-cst] does not support full syntax of
|
|
120
|
+
these dialects. One should expect the parser to crash for syntax that's more specific to
|
|
121
|
+
these dialects. But as long as the parsing succeeds, the formatting should also succeed.
|
|
122
|
+
Mainly one can expect the formatting of SELECT statements to work. But beyond that you should
|
|
123
|
+
keep your expectations low. You have been warned.
|
|
124
|
+
|
|
110
125
|
The specifics of the [SQL formatting style][STYLE_GUIDE] are still very much subject to change.
|
|
111
126
|
Though the general principles should be mostly in place by now.
|
|
112
127
|
|
package/dist/embedJson.js
CHANGED
|
@@ -53,7 +53,8 @@ var print_utils_1 = require("./print_utils");
|
|
|
53
53
|
var embedJson = function (path, options) {
|
|
54
54
|
var node = path.getValue(); // TODO: Don't use deprecated method
|
|
55
55
|
var parent = path.getParentNode();
|
|
56
|
-
if ((0, node_utils_1.isStringLiteral)(node) &&
|
|
56
|
+
if ((0, node_utils_1.isStringLiteral)(node) &&
|
|
57
|
+
((0, node_utils_1.isJsonLiteral)(parent) || (0, node_utils_1.isJsonbLiteral)(parent))) {
|
|
57
58
|
return function (textToDoc) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
59
|
var json, inlineQuote;
|
|
59
60
|
return __generator(this, function (_a) {
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,21 @@ exports.languages = [
|
|
|
20
20
|
name: "BigQuery SQL",
|
|
21
21
|
parsers: ["bigquery"],
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
extensions: [],
|
|
25
|
+
name: "Experimental MySQL SQL",
|
|
26
|
+
parsers: ["mysql"],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
extensions: [],
|
|
30
|
+
name: "Experimental MariaDB SQL",
|
|
31
|
+
parsers: ["mariadb"],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
extensions: [],
|
|
35
|
+
name: "Experimental PostgreSQL SQL",
|
|
36
|
+
parsers: ["postgresql"],
|
|
37
|
+
},
|
|
23
38
|
];
|
|
24
39
|
var createParser = function (dialect) { return ({
|
|
25
40
|
parse: function (text, options) {
|
|
@@ -38,6 +53,9 @@ var createParser = function (dialect) { return ({
|
|
|
38
53
|
exports.parsers = {
|
|
39
54
|
sqlite: createParser("sqlite"),
|
|
40
55
|
bigquery: createParser("bigquery"),
|
|
56
|
+
mysql: createParser("mysql"),
|
|
57
|
+
mariadb: createParser("mariadb"),
|
|
58
|
+
postgresql: createParser("postgresql"),
|
|
41
59
|
};
|
|
42
60
|
exports.printers = {
|
|
43
61
|
"sql-cst": {
|
package/dist/node_utils.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const isCreateTableStmt: (node: any) => node is import("sql-parse
|
|
|
7
7
|
export declare const isKeyword: (node: any) => node is import("sql-parser-cst").Keyword<string>;
|
|
8
8
|
export declare const isEmpty: (node: any) => node is import("sql-parser-cst").Empty;
|
|
9
9
|
export declare const isJsonLiteral: (node: any) => node is import("sql-parser-cst").JsonLiteral;
|
|
10
|
+
export declare const isJsonbLiteral: (node: any) => node is import("sql-parser-cst").JsonbLiteral;
|
|
10
11
|
export declare const isStringLiteral: (node: any) => node is import("sql-parser-cst").StringLiteral;
|
|
11
12
|
export declare const isArraySubscript: (node: any) => node is import("sql-parser-cst").ArraySubscript;
|
|
12
13
|
export declare const isAsClause: (node: any) => node is import("sql-parser-cst").AsClause<Node>;
|
package/dist/node_utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLanguageClause = exports.isCreateFunctionStmt = exports.isListExpr = exports.isParenExpr = exports.isAsClause = exports.isArraySubscript = exports.isStringLiteral = exports.isJsonLiteral = exports.isEmpty = exports.isKeyword = exports.isCreateTableStmt = exports.isFuncArgs = exports.isFuncCall = exports.isValuesClause = exports.isProgram = void 0;
|
|
3
|
+
exports.isLanguageClause = exports.isCreateFunctionStmt = exports.isListExpr = exports.isParenExpr = exports.isAsClause = exports.isArraySubscript = exports.isStringLiteral = exports.isJsonbLiteral = exports.isJsonLiteral = exports.isEmpty = exports.isKeyword = exports.isCreateTableStmt = exports.isFuncArgs = exports.isFuncCall = exports.isValuesClause = exports.isProgram = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
var is = function (type) {
|
|
6
6
|
return function (node) {
|
|
@@ -15,6 +15,7 @@ exports.isCreateTableStmt = is("create_table_stmt");
|
|
|
15
15
|
exports.isKeyword = is("keyword");
|
|
16
16
|
exports.isEmpty = is("empty");
|
|
17
17
|
exports.isJsonLiteral = is("json_literal");
|
|
18
|
+
exports.isJsonbLiteral = is("jsonb_literal");
|
|
18
19
|
exports.isStringLiteral = is("string_literal");
|
|
19
20
|
exports.isArraySubscript = is("array_subscript");
|
|
20
21
|
exports.isAsClause = is("as_clause");
|
package/dist/syntax/alias.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.aliasMap = void 0;
|
|
4
4
|
exports.aliasMap = {
|
|
5
|
-
alias: function (print) { return print.spaced(["expr", "asKw", "alias"]); },
|
|
5
|
+
alias: function (print) { return print.spaced(["expr", "asKw", "alias", "columnAliases"]); },
|
|
6
6
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AlterTableStmt, AllAlterActionNodes } from "sql-parser-cst";
|
|
2
2
|
import { CstToDocMap } from "../CstToDocMap";
|
|
3
|
-
export declare const alterTableMap:
|
|
3
|
+
export declare const alterTableMap: CstToDocMap<AlterTableStmt | AllAlterActionNodes>;
|
package/dist/syntax/base.d.ts
CHANGED
|
@@ -18,12 +18,13 @@ exports.constraintMap = {
|
|
|
18
18
|
constraint_deferrable: function (print) {
|
|
19
19
|
return print.spaced(["deferrableKw", "initiallyKw"]);
|
|
20
20
|
},
|
|
21
|
+
constraint_null: function (print) { return print("nullKw"); },
|
|
21
22
|
constraint_not_null: function (print) {
|
|
22
23
|
return (0, print_utils_1.group)(print.spaced(["notNullKw", "onConflict"]));
|
|
23
24
|
},
|
|
24
25
|
constraint_default: function (print) { return (0, print_utils_1.group)(print.spaced(["defaultKw", "expr"])); },
|
|
25
26
|
constraint_primary_key: function (print) {
|
|
26
|
-
return (0, print_utils_1.group)(print.spaced(["primaryKeyKw", "
|
|
27
|
+
return (0, print_utils_1.group)(print.spaced(["primaryKeyKw", "direction", "columns", "onConflict"]));
|
|
27
28
|
},
|
|
28
29
|
constraint_unique: function (print) {
|
|
29
30
|
return (0, print_utils_1.group)(print.spaced(["uniqueKw", "columns", "onConflict"]));
|
|
@@ -54,6 +55,18 @@ exports.constraintMap = {
|
|
|
54
55
|
},
|
|
55
56
|
constraint_auto_increment: function (print) { return print("autoIncrementKw"); },
|
|
56
57
|
on_conflict_clause: function (print) { return print.spaced(["onConflictKw", "resolutionKw"]); },
|
|
58
|
+
constraint_comment: function (print) { return print.spaced(["commentKw", "value"]); },
|
|
59
|
+
constraint_index: function (print) {
|
|
60
|
+
return print.spaced(["indexTypeKw", "indexKw", "columns"]);
|
|
61
|
+
},
|
|
62
|
+
constraint_visible: function (print) { return print.spaced(["visibleKw"]); },
|
|
63
|
+
constraint_column_format: function (print) {
|
|
64
|
+
return print.spaced(["columnFormatKw", "formatKw"]);
|
|
65
|
+
},
|
|
66
|
+
constraint_storage: function (print) { return print.spaced(["storageKw", "typeKw"]); },
|
|
67
|
+
constraint_engine_attribute: function (print, node) {
|
|
68
|
+
return (0, print_utils_1.join)(node.hasEq ? " = " : " ", print(["engineAttributeKw", "value"]));
|
|
69
|
+
},
|
|
57
70
|
};
|
|
58
71
|
var printUnnamedConstraint = function (print, node) {
|
|
59
72
|
if (node.deferrable) {
|
|
@@ -38,7 +38,17 @@ exports.createTableMap = {
|
|
|
38
38
|
column_definition: function (print) {
|
|
39
39
|
return print.spaced(["name", "dataType", "constraints"]);
|
|
40
40
|
},
|
|
41
|
-
table_option: function (print) {
|
|
41
|
+
table_option: function (print, node) {
|
|
42
|
+
if (node.value && node.hasEq) {
|
|
43
|
+
return [print.spaced("name"), " = ", print.spaced("value")];
|
|
44
|
+
}
|
|
45
|
+
else if (node.value) {
|
|
46
|
+
return [print.spaced("name"), " ", print.spaced("value")];
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return print.spaced("name");
|
|
50
|
+
}
|
|
51
|
+
},
|
|
42
52
|
create_table_like_clause: function (print) { return print.spaced(["likeKw", "name"]); },
|
|
43
53
|
create_table_copy_clause: function (print) { return print.spaced(["copyKw", "name"]); },
|
|
44
54
|
create_table_clone_clause: function (print) { return print.spaced(["cloneKw", "table"]); },
|
package/dist/syntax/data_type.js
CHANGED
|
@@ -8,6 +8,11 @@ exports.dataTypeMap = {
|
|
|
8
8
|
named_data_type: function (print, node) {
|
|
9
9
|
return ((0, utils_1.isArray)(node.nameKw) ? print.spaced : print)(["nameKw", "params"]);
|
|
10
10
|
},
|
|
11
|
+
array_data_type: function (print) { return print(["dataType", "bounds"]); },
|
|
12
|
+
array_bounds: function (print) { return ["[", print("bounds"), "]"]; },
|
|
13
|
+
with_time_zone_data_type: function (print) {
|
|
14
|
+
return print.spaced(["dataType", "withTimeZoneKw"]);
|
|
15
|
+
},
|
|
11
16
|
generic_type_params: function (print) {
|
|
12
17
|
return (0, print_utils_1.group)(["<", (0, print_utils_1.indent)([print_utils_1.softline, print("params")]), print_utils_1.softline, ">"]);
|
|
13
18
|
},
|
package/dist/syntax/dcl.d.ts
CHANGED
package/dist/syntax/delete.js
CHANGED
|
@@ -4,5 +4,7 @@ exports.deleteMap = void 0;
|
|
|
4
4
|
var print_utils_1 = require("../print_utils");
|
|
5
5
|
exports.deleteMap = {
|
|
6
6
|
delete_stmt: function (print) { return (0, print_utils_1.join)(print_utils_1.hardline, print("clauses")); },
|
|
7
|
-
delete_clause: function (print) {
|
|
7
|
+
delete_clause: function (print) {
|
|
8
|
+
return print.spaced(["deleteKw", "modifiers", "fromKw", "tables"]);
|
|
9
|
+
},
|
|
8
10
|
};
|
|
@@ -10,7 +10,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.bigqueryMap = void 0;
|
|
13
|
-
var print_utils_1 = require("
|
|
13
|
+
var print_utils_1 = require("../../print_utils");
|
|
14
14
|
exports.bigqueryMap = {
|
|
15
15
|
bigquery_options: function (print) { return print.spaced(["optionsKw", "options"]); },
|
|
16
16
|
bigquery_option_default_collate: function (print) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postgresqlMap = void 0;
|
|
4
|
+
exports.postgresqlMap = {
|
|
5
|
+
postgresql_operator_expr: function (print) { return print(["operatorKw", "expr"]); },
|
|
6
|
+
postgresql_operator: function (print) { return print("operator"); },
|
|
7
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sqliteMap = void 0;
|
|
4
|
-
var print_utils_1 = require("
|
|
4
|
+
var print_utils_1 = require("../../print_utils");
|
|
5
5
|
exports.sqliteMap = {
|
|
6
6
|
attach_database_stmt: function (print) {
|
|
7
7
|
return print.spaced(["attachKw", "databaseKw", "file", "asKw", "schema"]);
|
package/dist/syntax/expr.d.ts
CHANGED
package/dist/syntax/expr.js
CHANGED
|
@@ -50,6 +50,10 @@ exports.exprMap = {
|
|
|
50
50
|
if ((0, node_utils_1.isKeyword)(node.operator) && isBooleanOp(node.operator)) {
|
|
51
51
|
return (0, print_utils_1.join)(print_utils_1.line, [print("left"), print.spaced(["operator", "right"])]);
|
|
52
52
|
}
|
|
53
|
+
if (node.operator === "") {
|
|
54
|
+
// String concatenation with whitespace (MySQL / MariaDB)
|
|
55
|
+
return print.spaced(["left", "right"]);
|
|
56
|
+
}
|
|
53
57
|
return print.spaced(["left", "operator", "right"]);
|
|
54
58
|
},
|
|
55
59
|
prefix_op_expr: function (print, node) {
|
|
@@ -93,6 +97,7 @@ exports.exprMap = {
|
|
|
93
97
|
return (0, print_utils_1.group)(["[", (0, print_utils_1.indent)([print_utils_1.softline, print("expr")]), print_utils_1.softline, "]"]);
|
|
94
98
|
},
|
|
95
99
|
array_subscript_specifier: function (print) { return print(["specifierKw", "args"]); },
|
|
100
|
+
array_slice_specifier: function (print) { return [print("from"), ":", print("to")]; },
|
|
96
101
|
func_call: function (print) {
|
|
97
102
|
var fnCall = print(["name", "args"]);
|
|
98
103
|
var extras = print(["filter", "over"]);
|
|
@@ -103,19 +108,27 @@ exports.exprMap = {
|
|
|
103
108
|
return (0, print_utils_1.group)((0, print_utils_1.join)(" ", __spreadArray([fnCall], extras, true)));
|
|
104
109
|
}
|
|
105
110
|
},
|
|
106
|
-
func_args: function (print
|
|
111
|
+
func_args: function (print, node) {
|
|
112
|
+
return (0, print_utils_1.join)(print_utils_1.line, __spreadArray(__spreadArray(__spreadArray([], print(["distinctKw", "args"]), true), (node.nullHandlingKw ? print.spaced("nullHandlingKw") : []), true), print(["orderBy", "limit", "having"]), true));
|
|
113
|
+
},
|
|
107
114
|
filter_arg: function (print) { return print.spaced(["filterKw", "where"]); },
|
|
108
115
|
over_arg: function (print) { return print.spaced(["overKw", "window"]); },
|
|
109
116
|
having_arg: function (print) { return print.spaced(["havingKw", "minMaxKw", "expr"]); },
|
|
117
|
+
named_arg: function (print) {
|
|
118
|
+
return (0, print_utils_1.group)([print("name"), " ", "=>", (0, print_utils_1.indent)([print_utils_1.line, print("value")])]);
|
|
119
|
+
},
|
|
110
120
|
cast_expr: function (print) { return print(["castKw", "args"]); },
|
|
111
121
|
cast_arg: function (print) { return print.spaced(["expr", "asKw", "dataType", "format"]); },
|
|
112
122
|
cast_format: function (print) { return print.spaced(["formatKw", "string", "timezone"]); },
|
|
113
123
|
cast_format_timezone: function (print) { return print.spaced(["atTimeZoneKw", "timezone"]); },
|
|
124
|
+
cast_operator_expr: function (print) { return [print("expr"), "::", print("dataType")]; },
|
|
125
|
+
string_with_charset: function (print) { return ["_", print(["charset", "string"])]; },
|
|
114
126
|
raise_expr: function (print) { return print(["raiseKw", "args"]); },
|
|
115
127
|
raise_expr_type: function (print) { return print("typeKw"); },
|
|
116
128
|
extract_expr: function (print) { return print(["extractKw", "args"]); },
|
|
117
129
|
extract_from: function (print) { return print.spaced(["unit", "fromKw", "expr"]); },
|
|
118
130
|
week_expr: function (print) { return print(["weekKw", "args"]); },
|
|
131
|
+
interval_literal: function (print) { return print.spaced(["intervalKw", "string"]); },
|
|
119
132
|
interval_expr: function (print) { return print.spaced(["intervalKw", "expr", "unit"]); },
|
|
120
133
|
interval_unit_range: function (print) { return print.spaced(["fromUnit", "toKw", "toUnit"]); },
|
|
121
134
|
interval_unit: function (print) { return print("unitKw"); },
|
|
@@ -126,9 +139,16 @@ exports.exprMap = {
|
|
|
126
139
|
return (0, print_utils_1.group)(["(", (0, print_utils_1.indent)([print_utils_1.softline, print("expr")]), print_utils_1.softline, ")"]);
|
|
127
140
|
},
|
|
128
141
|
typed_expr: function (print) { return print(["dataType", "expr"]); },
|
|
142
|
+
row_constructor: function (print) { return print(["rowKw", "row"]); },
|
|
143
|
+
quantifier_expr: function (print) { return print.spaced(["quantifierKw", "expr"]); },
|
|
144
|
+
full_text_match_expr: function (print) {
|
|
145
|
+
return print.spaced(["matchKw", "columns", "againstKw", "args"]);
|
|
146
|
+
},
|
|
147
|
+
full_text_match_args: function (print) { return print.spaced(["expr", "modifier"]); },
|
|
129
148
|
number_literal: function (print) { return print("text"); },
|
|
130
149
|
boolean_literal: function (print) { return print("valueKw"); },
|
|
131
150
|
string_literal: function (print) { return print("text"); },
|
|
151
|
+
blob_literal: function (print) { return print("text"); },
|
|
132
152
|
null_literal: function (print) { return print("nullKw"); },
|
|
133
153
|
numeric_literal: function (print) { return print.spaced(["numericKw", "string"]); },
|
|
134
154
|
bignumeric_literal: function (print) { return print.spaced(["bignumericKw", "string"]); },
|
|
@@ -137,6 +157,7 @@ exports.exprMap = {
|
|
|
137
157
|
datetime_literal: function (print) { return print.spaced(["datetimeKw", "string"]); },
|
|
138
158
|
timestamp_literal: function (print) { return print.spaced(["timestampKw", "string"]); },
|
|
139
159
|
json_literal: function (print) { return print.spaced(["jsonKw", "string"]); },
|
|
160
|
+
jsonb_literal: function (print) { return print.spaced(["jsonbKw", "string"]); },
|
|
140
161
|
identifier: function (print) { return print("text"); },
|
|
141
162
|
variable: function (print) { return print("text"); },
|
|
142
163
|
parameter: function (print) { return print("text"); },
|
package/dist/syntax/index.d.ts
CHANGED
package/dist/syntax/insert.d.ts
CHANGED
package/dist/syntax/insert.js
CHANGED
|
@@ -3,30 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.insertMap = void 0;
|
|
4
4
|
var print_utils_1 = require("../print_utils");
|
|
5
5
|
exports.insertMap = {
|
|
6
|
-
insert_stmt: function (print,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var printedClauses = print("clauses");
|
|
13
|
-
var before = printedClauses.slice(0, columnsClauseIndex);
|
|
14
|
-
var columnsClause = printedClauses[columnsClauseIndex];
|
|
15
|
-
var after = printedClauses.slice(columnsClauseIndex + 1);
|
|
16
|
-
return [
|
|
17
|
-
(0, print_utils_1.join)(print_utils_1.hardline, before),
|
|
18
|
-
columnsClause,
|
|
19
|
-
after.length > 0 ? [print_utils_1.hardline, (0, print_utils_1.join)(print_utils_1.hardline, after)] : [],
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return (0, print_utils_1.join)(print_utils_1.hardline, print("clauses"));
|
|
24
|
-
}
|
|
6
|
+
insert_stmt: function (print) { return (0, print_utils_1.join)(print_utils_1.hardline, print("clauses")); },
|
|
7
|
+
insert_clause: function (print, node) {
|
|
8
|
+
return (0, print_utils_1.group)([
|
|
9
|
+
print.spaced(["insertKw", "modifiers", "orAction", "intoKw", "table"]),
|
|
10
|
+
node.columns ? (0, print_utils_1.indent)([print_utils_1.hardline, print("columns")]) : [],
|
|
11
|
+
]);
|
|
25
12
|
},
|
|
26
|
-
insert_clause: function (print) {
|
|
27
|
-
return (0, print_utils_1.group)([print.spaced(["insertKw", "orAction", "intoKw", "table"])]);
|
|
28
|
-
},
|
|
29
|
-
insert_columns_clause: function (print) { return (0, print_utils_1.indent)([print_utils_1.hardline, print("columns")]); },
|
|
30
13
|
values_clause: function (print) {
|
|
31
14
|
return (0, print_utils_1.group)([print("valuesKw"), (0, print_utils_1.indent)([print_utils_1.hardline, print("values")])]);
|
|
32
15
|
},
|
|
@@ -41,4 +24,12 @@ exports.insertMap = {
|
|
|
41
24
|
print("updateKw"),
|
|
42
25
|
(0, print_utils_1.indent)([print_utils_1.hardline, (0, print_utils_1.join)(print_utils_1.hardline, print(["set", "where"]))]),
|
|
43
26
|
]; },
|
|
27
|
+
row_alias_clause: function (print, node) { return [
|
|
28
|
+
print.spaced(["asKw", "rowAlias"]),
|
|
29
|
+
node.columnAliases ? (0, print_utils_1.indent)([print_utils_1.hardline, print("columnAliases")]) : [],
|
|
30
|
+
]; },
|
|
31
|
+
on_duplicate_key_update_clause: function (print) { return [
|
|
32
|
+
print.spaced("onDuplicateKeyUpdateKw"),
|
|
33
|
+
(0, print_utils_1.indent)([print_utils_1.hardline, print("assignments")]),
|
|
34
|
+
]; },
|
|
44
35
|
};
|
package/dist/syntax/merge.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AllPreparedStatementNodes } from "sql-parser-cst";
|
|
2
2
|
import { CstToDocMap } from "../CstToDocMap";
|
|
3
|
-
export declare const preparedStatementsMap:
|
|
3
|
+
export declare const preparedStatementsMap: CstToDocMap<AllPreparedStatementNodes>;
|
package/dist/syntax/schema.d.ts
CHANGED
package/dist/syntax/select.d.ts
CHANGED
package/dist/syntax/select.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.selectMap = void 0;
|
|
4
13
|
var utils_1 = require("../utils");
|
|
@@ -11,26 +20,61 @@ exports.selectMap = {
|
|
|
11
20
|
var lineType = (0, print_utils_1.containsNewline)(node, opts) ? print_utils_1.hardline : print_utils_1.line;
|
|
12
21
|
return (0, print_utils_1.group)((0, print_utils_1.join)(lineType, print("clauses")));
|
|
13
22
|
},
|
|
23
|
+
// WITH clause
|
|
14
24
|
with_clause: function (print) {
|
|
15
25
|
return (0, print_utils_1.group)([
|
|
16
26
|
print.spaced(["withKw", "recursiveKw"]),
|
|
17
27
|
(0, print_utils_1.indent)([print_utils_1.line, print("tables")]),
|
|
18
28
|
]);
|
|
19
29
|
},
|
|
20
|
-
common_table_expr: function (print) { return [
|
|
30
|
+
common_table_expr: function (print, node) { return [
|
|
21
31
|
print(["table", "columns"]),
|
|
22
32
|
" ",
|
|
23
33
|
print.spaced(["asKw", "materializedKw", "expr"]),
|
|
34
|
+
(0, print_utils_1.group)([
|
|
35
|
+
node.search || node.cycle
|
|
36
|
+
? (0, print_utils_1.indent)([print_utils_1.line, (0, print_utils_1.join)(print_utils_1.line, print(["search", "cycle"]))])
|
|
37
|
+
: [],
|
|
38
|
+
]),
|
|
24
39
|
]; },
|
|
40
|
+
cte_search_clause: function (print) {
|
|
41
|
+
return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
|
|
42
|
+
[print.spaced("searchKw"), (0, print_utils_1.group)((0, print_utils_1.indent)([print_utils_1.line, print("columns")]))],
|
|
43
|
+
print.spaced(["setKw", "resultColumn"]),
|
|
44
|
+
]));
|
|
45
|
+
},
|
|
46
|
+
cte_cycle_clause: function (print, node) {
|
|
47
|
+
return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
|
|
48
|
+
[print("cycleKw"), (0, print_utils_1.group)((0, print_utils_1.indent)([print_utils_1.line, print("columns")]))],
|
|
49
|
+
print.spaced(["setKw", "resultColumn"]),
|
|
50
|
+
node.values ? print("values") : undefined,
|
|
51
|
+
print.spaced(["usingKw", "pathColumn"]),
|
|
52
|
+
].filter(utils_1.isDefined)));
|
|
53
|
+
},
|
|
54
|
+
cte_cycle_clause_values: function (print) {
|
|
55
|
+
return (0, print_utils_1.join)(print_utils_1.line, [
|
|
56
|
+
print.spaced(["toKw", "markValue"]),
|
|
57
|
+
print.spaced(["defaultKw", "defaultValue"]),
|
|
58
|
+
]);
|
|
59
|
+
},
|
|
60
|
+
// SELECT clause
|
|
25
61
|
select_clause: function (print, node, path, opts) {
|
|
26
62
|
return (0, print_utils_1.group)([
|
|
27
|
-
print.spaced(["selectKw", "
|
|
28
|
-
(0, print_utils_1.indent)([print_utils_1.line, print("columns")]),
|
|
63
|
+
print.spaced(["selectKw", "modifiers"]),
|
|
64
|
+
node.columns ? (0, print_utils_1.indent)([print_utils_1.line, print("columns")]) : [],
|
|
29
65
|
(0, print_utils_1.containsNewline)(node, opts) ? print_utils_1.breakParent : [],
|
|
30
66
|
]);
|
|
31
67
|
},
|
|
68
|
+
select_all: function (print) { return print.spaced(["allKw"]); },
|
|
69
|
+
select_distinct: function (print) { return print.spaced(["distinctKw"]); },
|
|
70
|
+
select_distinct_on: function (print) {
|
|
71
|
+
return (0, print_utils_1.group)([print.spaced(["distinctOnKw", "columns"])]);
|
|
72
|
+
},
|
|
73
|
+
select_as_struct: function (print) { return print.spaced(["asStructKw"]); },
|
|
74
|
+
select_as_value: function (print) { return print.spaced(["asValueKw"]); },
|
|
32
75
|
except_columns: function (print) { return print.spaced(["expr", "exceptKw", "columns"]); },
|
|
33
76
|
replace_columns: function (print) { return print.spaced(["expr", "replaceKw", "columns"]); },
|
|
77
|
+
// FROM clause
|
|
34
78
|
from_clause: function (print) {
|
|
35
79
|
return (0, print_utils_1.group)([print("fromKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
36
80
|
},
|
|
@@ -56,6 +100,8 @@ exports.selectMap = {
|
|
|
56
100
|
},
|
|
57
101
|
join_on_specification: function (print) { return (0, print_utils_1.group)(print.spaced(["onKw", "expr"])); },
|
|
58
102
|
join_using_specification: function (print) { return (0, print_utils_1.group)(print.spaced(["usingKw", "expr"])); },
|
|
103
|
+
table_with_inheritance: function (print) { return [print("table"), " ", "*"]; },
|
|
104
|
+
table_without_inheritance: function (print) { return print.spaced(["onlyKw", "table"]); },
|
|
59
105
|
indexed_table: function (print) { return print.spaced(["table", "indexedByKw", "index"]); },
|
|
60
106
|
not_indexed_table: function (print) { return print.spaced(["table", "notIndexedKw"]); },
|
|
61
107
|
unnest_expr: function (print) { return print(["unnestKw", "expr"]); },
|
|
@@ -85,46 +131,117 @@ exports.selectMap = {
|
|
|
85
131
|
]));
|
|
86
132
|
},
|
|
87
133
|
tablesample_expr: function (print) {
|
|
88
|
-
return (0, print_utils_1.group)([
|
|
134
|
+
return (0, print_utils_1.group)([
|
|
135
|
+
print("left"),
|
|
136
|
+
print_utils_1.line,
|
|
137
|
+
print.spaced(["tablesampleKw", "method", "args", "repeatable"]),
|
|
138
|
+
]);
|
|
89
139
|
},
|
|
140
|
+
tablesample_method: function (print) { return print.spaced(["methodKw"]); },
|
|
90
141
|
tablesample_percent: function (print) { return print.spaced(["percent", "percentKw"]); },
|
|
142
|
+
tablesample_repeatable: function (print) { return print.spaced(["repeatableKw", "seed"]); },
|
|
91
143
|
for_system_time_as_of_expr: function (print) {
|
|
92
144
|
return (0, print_utils_1.group)([print("left"), print_utils_1.line, print.spaced(["forSystemTimeAsOfKw", "expr"])]);
|
|
93
145
|
},
|
|
146
|
+
partitioned_table: function (print) {
|
|
147
|
+
return print.spaced(["table", "partitionKw", "partitions"]);
|
|
148
|
+
},
|
|
149
|
+
dual_table: function (print) { return print("dualKw"); },
|
|
150
|
+
lateral_derived_table: function (print) { return print.spaced(["lateralKw", "expr"]); },
|
|
151
|
+
rows_from_expr: function (print) { return print.spaced(["rowsFromKw", "expr"]); },
|
|
152
|
+
with_ordinality_expr: function (print) { return print.spaced(["expr", "withOrdinalityKw"]); },
|
|
153
|
+
func_call_with_column_definitions: function (print) {
|
|
154
|
+
return print.spaced(["funcCall", "asKw", "columns"]);
|
|
155
|
+
},
|
|
156
|
+
// WHERE clause
|
|
94
157
|
where_clause: function (print) {
|
|
95
158
|
return (0, print_utils_1.group)([print("whereKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
96
159
|
},
|
|
97
|
-
|
|
98
|
-
|
|
160
|
+
// ORDER BY clause
|
|
161
|
+
order_by_clause: function (print, node) {
|
|
162
|
+
return (0, print_utils_1.group)([
|
|
163
|
+
print.spaced("orderByKw"),
|
|
164
|
+
(0, print_utils_1.indent)([
|
|
165
|
+
print_utils_1.line,
|
|
166
|
+
(0, print_utils_1.join)(print_utils_1.line, __spreadArray([
|
|
167
|
+
print("specifications")
|
|
168
|
+
], (node.withRollupKw ? print.spaced("withRollupKw") : []), true)),
|
|
169
|
+
]),
|
|
170
|
+
]);
|
|
171
|
+
},
|
|
172
|
+
sort_specification: function (print) {
|
|
173
|
+
return print.spaced(["expr", "direction", "nullHandlingKw"]);
|
|
99
174
|
},
|
|
100
|
-
|
|
101
|
-
|
|
175
|
+
sort_direction_asc: function (print) { return print("ascKw"); },
|
|
176
|
+
sort_direction_desc: function (print) { return print("descKw"); },
|
|
177
|
+
sort_direction_using_operator: function (print) {
|
|
178
|
+
return print.spaced(["usingKw", "operator"]);
|
|
179
|
+
},
|
|
180
|
+
// GROUP BY clause
|
|
181
|
+
group_by_clause: function (print, node) {
|
|
182
|
+
return (0, print_utils_1.group)([
|
|
183
|
+
print.spaced(["groupByKw", "distinctKw"]),
|
|
184
|
+
(0, print_utils_1.indent)([
|
|
185
|
+
print_utils_1.line,
|
|
186
|
+
(0, print_utils_1.join)(print_utils_1.line, __spreadArray([
|
|
187
|
+
print("columns")
|
|
188
|
+
], (node.withRollupKw ? print.spaced("withRollupKw") : []), true)),
|
|
189
|
+
]),
|
|
190
|
+
]);
|
|
102
191
|
},
|
|
103
192
|
group_by_rollup: function (print) { return print(["rollupKw", "columns"]); },
|
|
193
|
+
group_by_cube: function (print) { return print(["cubeKw", "columns"]); },
|
|
194
|
+
group_by_grouping_sets: function (print) {
|
|
195
|
+
return print.spaced(["groupingSetsKw", "columns"]);
|
|
196
|
+
},
|
|
197
|
+
// PARTITION BY clause
|
|
104
198
|
partition_by_clause: function (print) {
|
|
105
199
|
return (0, print_utils_1.group)([
|
|
106
200
|
print.spaced("partitionByKw"),
|
|
107
201
|
(0, print_utils_1.indent)([print_utils_1.line, print("specifications")]),
|
|
108
202
|
]);
|
|
109
203
|
},
|
|
204
|
+
// CLUSTER BY clause
|
|
110
205
|
cluster_by_clause: function (print) {
|
|
111
206
|
return (0, print_utils_1.group)([print.spaced("clusterByKw"), (0, print_utils_1.indent)([print_utils_1.line, print("columns")])]);
|
|
112
207
|
},
|
|
208
|
+
// HAVING clause
|
|
113
209
|
having_clause: function (print) {
|
|
114
210
|
return (0, print_utils_1.group)([print("havingKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
115
211
|
},
|
|
212
|
+
// QUALIFY clause
|
|
116
213
|
qualify_clause: function (print) {
|
|
117
214
|
return (0, print_utils_1.group)([print("qualifyKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
118
215
|
},
|
|
216
|
+
// RETURNING clause
|
|
119
217
|
returning_clause: function (print) {
|
|
120
218
|
return (0, print_utils_1.group)([print("returningKw"), (0, print_utils_1.indent)([print_utils_1.line, print("columns")])]);
|
|
121
219
|
},
|
|
220
|
+
// LIMIT clause
|
|
122
221
|
limit_clause: function (print, node) {
|
|
123
|
-
return (0, print_utils_1.group)([
|
|
222
|
+
return (0, print_utils_1.group)([
|
|
223
|
+
print("limitKw"),
|
|
224
|
+
(0, print_utils_1.indent)([
|
|
225
|
+
print_utils_1.line,
|
|
226
|
+
printLimitValues(print, node),
|
|
227
|
+
node.rowsExamined ? [print_utils_1.line, print("rowsExamined")] : [],
|
|
228
|
+
]),
|
|
229
|
+
]);
|
|
124
230
|
},
|
|
125
|
-
|
|
126
|
-
|
|
231
|
+
limit_all: function (print) { return print("allKw"); },
|
|
232
|
+
limit_rows_examined: function (print) { return print.spaced(["rowsExaminedKw", "count"]); },
|
|
233
|
+
// OFFSET clause
|
|
234
|
+
offset_clause: function (print) {
|
|
235
|
+
return (0, print_utils_1.group)([
|
|
236
|
+
print("offsetKw"),
|
|
237
|
+
(0, print_utils_1.indent)([print_utils_1.line, print.spaced(["offset", "rowsKw"])]),
|
|
238
|
+
]);
|
|
239
|
+
},
|
|
240
|
+
// FETCH clause
|
|
241
|
+
fetch_clause: function (print) {
|
|
242
|
+
return print.spaced(["fetchKw", "count", "rowsKw", "withTiesKw"]);
|
|
127
243
|
},
|
|
244
|
+
// WINDOW clause
|
|
128
245
|
window_clause: function (print, node) {
|
|
129
246
|
var lineType = node.namedWindows.items.length > 1 ? print_utils_1.hardline : print_utils_1.line;
|
|
130
247
|
return (0, print_utils_1.group)([
|
|
@@ -143,6 +260,55 @@ exports.selectMap = {
|
|
|
143
260
|
var lineType = itemCount > 1 ? print_utils_1.hardline : print_utils_1.line;
|
|
144
261
|
return (0, print_utils_1.group)((0, print_utils_1.join)(lineType, print(["baseWindowName", "partitionBy", "orderBy", "frame"])));
|
|
145
262
|
},
|
|
263
|
+
// INTO clause
|
|
264
|
+
into_table_clause: function (print) {
|
|
265
|
+
return print.spaced(["intoKw", "temporaryKw", "unloggedKw", "tableKw", "name"]);
|
|
266
|
+
},
|
|
267
|
+
into_variables_clause: function (print) {
|
|
268
|
+
return (0, print_utils_1.group)([print("intoKw"), (0, print_utils_1.indent)([print_utils_1.line, print("variables")])]);
|
|
269
|
+
},
|
|
270
|
+
into_dumpfile_clause: function (print) { return print.spaced(["intoDumpfileKw", "filename"]); },
|
|
271
|
+
into_outfile_clause: function (print, node) {
|
|
272
|
+
var hasOptions = node.charset || node.fields || node.lines;
|
|
273
|
+
return (0, print_utils_1.group)([
|
|
274
|
+
print.spaced(["intoOutfileKw", "filename"]),
|
|
275
|
+
hasOptions
|
|
276
|
+
? (0, print_utils_1.indent)([
|
|
277
|
+
print_utils_1.hardline,
|
|
278
|
+
(0, print_utils_1.join)(print_utils_1.hardline, print(["charset", "fields", "lines"])),
|
|
279
|
+
])
|
|
280
|
+
: [],
|
|
281
|
+
]);
|
|
282
|
+
},
|
|
283
|
+
outfile_fields: function (print) { return print.spaced(["fieldsKw", "options"]); },
|
|
284
|
+
outfile_lines: function (print) { return print.spaced(["linesKw", "options"]); },
|
|
285
|
+
outfile_option_character_set: function (print) {
|
|
286
|
+
return print.spaced(["characterSetKw", "value"]);
|
|
287
|
+
},
|
|
288
|
+
outfile_option_starting_by: function (print) {
|
|
289
|
+
return print.spaced(["startingByKw", "value"]);
|
|
290
|
+
},
|
|
291
|
+
outfile_option_terminated_by: function (print) {
|
|
292
|
+
return print.spaced(["terminatedByKw", "value"]);
|
|
293
|
+
},
|
|
294
|
+
outfile_option_enclosed_by: function (print) {
|
|
295
|
+
return print.spaced(["optionallyKw", "enclosedByKw", "value"]);
|
|
296
|
+
},
|
|
297
|
+
outfile_option_escaped_by: function (print) { return print.spaced(["escapedByKw", "value"]); },
|
|
298
|
+
// FOR clause (locking)
|
|
299
|
+
for_clause: function (print, node) {
|
|
300
|
+
return (0, print_utils_1.group)([
|
|
301
|
+
print.spaced(["forKw", "lockStrengthKw", "tables"]),
|
|
302
|
+
node.waitingKw ? (0, print_utils_1.indent)([print_utils_1.line, print.spaced("waitingKw")]) : [],
|
|
303
|
+
]);
|
|
304
|
+
},
|
|
305
|
+
for_clause_tables: function (print) { return [
|
|
306
|
+
print("ofKw"),
|
|
307
|
+
(0, print_utils_1.indent)([print_utils_1.line, print("tables")]),
|
|
308
|
+
]; },
|
|
309
|
+
lock_in_share_mode_clause: function (print) { return print.spaced("lockInShareModeKw"); },
|
|
310
|
+
// TABLE clause
|
|
311
|
+
table_clause: function (print) { return print.spaced(["tableKw", "table"]); },
|
|
146
312
|
};
|
|
147
313
|
var printLimitValues = function (print, node) {
|
|
148
314
|
if (node.offsetKw) {
|
|
@@ -16,7 +16,6 @@ var alias_1 = require("./alias");
|
|
|
16
16
|
var alter_table_1 = require("./alter_table");
|
|
17
17
|
var analyze_1 = require("./analyze");
|
|
18
18
|
var base_1 = require("./base");
|
|
19
|
-
var bigquery_1 = require("./bigquery");
|
|
20
19
|
var constraint_1 = require("./constraint");
|
|
21
20
|
var create_table_1 = require("./create_table");
|
|
22
21
|
var data_type_1 = require("./data_type");
|
|
@@ -37,10 +36,13 @@ var proc_clause_1 = require("./proc_clause");
|
|
|
37
36
|
var program_1 = require("./program");
|
|
38
37
|
var schema_1 = require("./schema");
|
|
39
38
|
var select_1 = require("./select");
|
|
40
|
-
var sqlite_1 = require("./sqlite");
|
|
41
39
|
var transaction_1 = require("./transaction");
|
|
42
40
|
var trigger_1 = require("./trigger");
|
|
43
41
|
var truncate_1 = require("./truncate");
|
|
44
42
|
var update_1 = require("./update");
|
|
45
43
|
var view_1 = require("./view");
|
|
46
|
-
|
|
44
|
+
var bigquery_1 = require("./dialects/bigquery");
|
|
45
|
+
var mysql_1 = require("./dialects/mysql");
|
|
46
|
+
var sqlite_1 = require("./dialects/sqlite");
|
|
47
|
+
var postgresql_1 = require("./dialects/postgresql");
|
|
48
|
+
exports.transformMap = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, alias_1.aliasMap), alter_table_1.alterTableMap), analyze_1.analyzeMap), base_1.baseMap), constraint_1.constraintMap), create_table_1.createTableMap), data_type_1.dataTypeMap), dcl_1.dclMap), delete_1.deleteMap), drop_table_1.dropTableMap), explain_1.explainMap), expr_1.exprMap), frame_1.frameMap), function_1.functionMap), index_1.indexMap), insert_1.insertMap), merge_1.mergeMap), prepared_statements_1.preparedStatementsMap), proc_clause_1.procClauseMap), procedural_language_1.proceduralLanguageMap), procedure_1.procedureMap), program_1.programMap), schema_1.schemaMap), select_1.selectMap), transaction_1.transactionMap), trigger_1.triggerMap), truncate_1.truncateMap), update_1.updateMap), view_1.viewMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), sqlite_1.sqliteMap);
|
package/dist/syntax/trigger.d.ts
CHANGED
package/dist/syntax/update.d.ts
CHANGED
package/dist/syntax/update.js
CHANGED
|
@@ -5,7 +5,7 @@ var print_utils_1 = require("../print_utils");
|
|
|
5
5
|
exports.updateMap = {
|
|
6
6
|
update_stmt: function (print) { return (0, print_utils_1.join)(print_utils_1.hardline, print("clauses")); },
|
|
7
7
|
update_clause: function (print) {
|
|
8
|
-
return print.spaced(["updateKw", "
|
|
8
|
+
return print.spaced(["updateKw", "modifiers", "orAction", "tables"]);
|
|
9
9
|
},
|
|
10
10
|
set_clause: function (print, node) {
|
|
11
11
|
if (node.assignments.items.length > 1) {
|
package/dist/syntax/view.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-sql-cst",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Prettier plugin for SQL",
|
|
5
5
|
"author": "Rene Saarsoo <nene@triin.net>",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"clean": "rm -rf dist",
|
|
23
23
|
"build": "yarn clean && tsc",
|
|
24
24
|
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
|
|
25
|
-
"pretty": "prettier -w src/"
|
|
25
|
+
"pretty": "prettier -w src/ test/",
|
|
26
|
+
"ts:check": "tsc --noEmit"
|
|
26
27
|
},
|
|
27
28
|
"keywords": [
|
|
28
29
|
"prettier",
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
],
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"prettier": "^3.0.3",
|
|
34
|
-
"sql-parser-cst": "^0.
|
|
35
|
+
"sql-parser-cst": "^0.21.1"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/jest": "^29.2.5",
|