Skip to content

Commit 000c336

Browse files
committed
refactor: upgrade version
1 parent 38c4eb0 commit 000c336

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

ast/postgresql.ts

+38-20
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
export type start = multiple_stmt | create_function_stmt;
99

10-
export type cmd_stmt = drop_stmt | create_stmt | declare_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt | show_stmt | deallocate_stmt | grant_revoke_stmt | if_else_stmt | raise_stmt | execute_stmt | for_loop_stmt | transaction_stmt;
10+
export type cmd_stmt = drop_stmt | create_stmt | declare_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt | show_stmt | deallocate_stmt | grant_revoke_stmt | if_else_stmt | raise_stmt | execute_stmt | for_loop_stmt | transaction_stmt | comment_on_stmt;
1111

1212
export type create_stmt = create_table_stmt | create_constraint_trigger | create_extension_stmt | create_index_stmt | create_sequence | create_db_stmt | create_domain_stmt | create_type_stmt | create_view_stmt | create_aggregate_stmt;
1313

@@ -111,12 +111,12 @@ export type declare_stmt_t = { type: 'declare'; declare: declare_variable_item[]
111111

112112
export type declare_stmt = AstStatement<declare_stmt_t>;
113113

114-
export type create_func_opt = literal_string | { type: 'as'; begin?: string; declare?: declare_stmt; expr: multiple_stmt; end?: string; symbol: string; } | literal_numeric | { type: "set"; parameter: ident_name; value?: { prefix: string; expr: expr }};
114+
export type create_func_opt = literal_string | { type: 'as'; begin?: string; declare?: declare_stmt; expr: multiple_stmt; end?: string; symbol: string; } | literal_numeric | { type: "set"; parameter: ident_name; value?: { prefix: string; expr: expr }} | return_stmt;
115115

116116
export type create_function_stmt_t = {
117117
type: 'create';
118118
replace?: string;
119-
name: { schema?: string; name: string };
119+
name: proc_func_name;
120120
args?: alter_func_args;
121121
returns?: func_returns;
122122
keyword: 'function';
@@ -820,15 +820,37 @@ export interface for_loop_stmt_t {
820820

821821
export type for_loop_stmt = AstStatement<for_loop_stmt_t>;
822822

823+
export type transaction_mode_isolation_level = { type: 'origin'; value: string; } | ignore;
824+
825+
export type transaction_mode = { type: 'origin'; value: string; } | ignore;
826+
827+
export type transaction_mode_list = transaction_mode[];
828+
823829
export interface transaction_stmt_t {
824830
type: 'transaction';
825831
expr: {
826-
type: 'origin',
827-
value: string
832+
action: {
833+
type: 'origin',
834+
value: string
835+
};
836+
keyword?: string;
837+
modes?: transaction_mode[];
828838
}
829839
}
830840

831-
export type transaction_stmt = AstStatement<transaction_stmt_t>;
841+
export type transaction_stmt = AstStatement<transaction_stmt_t> | ignore;
842+
843+
export type comment_on_option = { type: string; name: table_name; } | { type: string; name: column_ref; } | { type: string; name: ident; };
844+
845+
export type comment_on_is = { keyword: 'is'; expr: literal_string | literal_null; };
846+
847+
export interface comment_on_stmt_t {
848+
type: 'comment';
849+
target: comment_on_option;
850+
expr: comment_on_is;
851+
}
852+
853+
export type comment_on_stmt = AstStatement<comment_on_stmt_t>;
832854

833855
export interface select_stmt_node extends select_stmt_nake {
834856
parentheses: true;
@@ -842,7 +864,7 @@ export type cte_definition = { name: { type: 'default'; value: string; }; stmt:
842864

843865
export type cte_column_definition = column_ref_list;
844866

845-
export type distinct_on = {type: string; columns: column_ref_list;} | { type: string | undefined; };
867+
export type distinct_on = {type: string; columns: column_list_items;} | { type: string | undefined; };
846868

847869

848870

@@ -866,7 +888,9 @@ export type option_clause = query_option[];
866888

867889
export type query_option = 'SQL_CALC_FOUND_ROWS'| 'SQL_CACHE'| 'SQL_NO_CACHE'| 'SQL_BIG_RESULT'| 'SQL_SMALL_RESULT'| 'SQL_BUFFER_RESULT';
868890

869-
export type column_clause = 'ALL' | '*' | column_list_item[] | column_list_item[];
891+
export type column_list_items = column_list_item[];
892+
893+
export type column_clause = 'ALL' | '*' | column_list_item[] | column_list_items;
870894

871895
export type array_index = { brackets: boolean, number: number };
872896

@@ -1448,6 +1472,8 @@ type KW_RECURSIVE = never;
14481472

14491473
type KW_REPLACE = never;
14501474

1475+
type KW_RETURN = never;
1476+
14511477
type KW_RETURNING = never;
14521478

14531479
type KW_RENAME = never;
@@ -1480,6 +1506,8 @@ type KW_TABLESPACE = never;
14801506

14811507
type KW_COLLATE = never;
14821508

1509+
type KW_COLLATION = never;
1510+
14831511
type KW_DEALLOCATE = never;
14841512

14851513
type KW_ON = never;
@@ -1628,6 +1656,8 @@ type KW_MEDIUMTEXT = never;
16281656

16291657
type KW_LONGTEXT = never;
16301658

1659+
type KW_MEDIUMINT = never;
1660+
16311661
type KW_BIGINT = never;
16321662

16331663
type KW_ENUM = never;
@@ -1734,8 +1764,6 @@ type KW_VAR_PRE_DOLLAR_DOUBLE = never;
17341764

17351765
type KW_VAR_PRE = never;
17361766

1737-
type KW_RETURN = never;
1738-
17391767
type KW_ASSIGN = never;
17401768

17411769
type KW_DOUBLE_COLON = never;
@@ -1899,8 +1927,6 @@ export type binary_type = data_type;
18991927

19001928
export type character_varying = string;
19011929

1902-
1903-
19041930
export type character_string_type = data_type;
19051931

19061932
export type numeric_type_suffix = any[];;
@@ -1921,16 +1947,10 @@ export type timezone = string[];;
19211947

19221948

19231949

1924-
1925-
1926-
1927-
19281950
export type time_type = data_type;
19291951

19301952

19311953

1932-
1933-
19341954
export type datetime_type = data_type | time_type;
19351955

19361956

@@ -1951,8 +1971,6 @@ export type serial_interval_type = data_type;
19511971

19521972

19531973

1954-
1955-
19561974
export type text_type = data_type;
19571975

19581976

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-sql-parser",
3-
"version": "5.3.2",
3+
"version": "5.3.3",
44
"description": "simple node sql parser",
55
"main": "index.js",
66
"types": "types.d.ts",

0 commit comments

Comments
 (0)