Skip to content

Commit fbac7c7

Browse files
committed
refactor: upgrade version
1 parent 2d44f68 commit fbac7c7

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

ast/postgresql.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type cmd_stmt = drop_stmt | create_stmt | declare_stmt | truncate_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

14-
export type alter_stmt = alter_table_stmt | alter_schema_stmt | alter_domain_type_stmt | alter_function_stmt | alter_aggregate_stmt;
14+
export type alter_stmt = alter_table_stmt | alter_schema_stmt | alter_domain_type_stmt | alter_function_stmt | alter_aggregate_stmt | alter_sequence_stmt;
1515

1616
export type crud_stmt = union_stmt | update_stmt | replace_insert_stmt | insert_no_columns_stmt | delete_stmt | cmd_stmt | proc_stmts;
1717

@@ -399,6 +399,28 @@ export type alter_func_args = alter_func_arg_item[];
399399

400400
export type alter_aggregate_stmt = AstStatement<alter_resource_stmt_node>;
401401

402+
export type alter_sequence_definition = { "resource": "sequence", prefix?: string,value: literal_string }
403+
404+
export type alter_sequence_definition_owner = alter_sequence_definition;
405+
406+
export type alter_sequence_definition_rename = alter_sequence_definition;
407+
408+
export type alter_sequence_definition_set = alter_sequence_definition;
409+
410+
export type alter_sequence_definition = alter_sequence_definition_owner | alter_sequence_definition_rename | alter_sequence_definition_set;
411+
412+
export type alter_sequence_definition_list = alter_sequence_definition[];
413+
414+
export type alter_sequence_stmt = {
415+
type: 'alter',
416+
keyword: 'sequence',
417+
if_exists?: 'if exists',
418+
sequence: [table_name],
419+
create_definitions?: create_sequence_definition_list | alter_sequence_definition_list
420+
}
421+
422+
export type alter_sequence_stmt = AstStatement<alter_sequence_stmt>;
423+
402424
export type alter_function_stmt = AstStatement<alter_resource_stmt_node>;
403425

404426
export interface alter_resource_stmt_node {
@@ -1168,7 +1190,7 @@ export type case_expr = {
11681190

11691191
export type case_when_then_list = case_when_then[];
11701192

1171-
export type case_when_then = { type: 'when'; cond: or_and_where_expr; result: expr; };
1193+
export type case_when_then = { type: 'when'; cond: or_and_expr; result: expr_item; };
11721194

11731195
export type case_else = { type: 'else'; condition?: never; result: expr; };
11741196

@@ -1251,7 +1273,9 @@ export type unary_expr_or_primary = jsonb_expr | unary_expr;
12511273

12521274
export type unary_operator = "!" | "-" | "+" | "~";
12531275

1254-
export type jsonb_expr = primary | binary_expr;
1276+
export type primary_array_index = primary & { array_index: array_index };
1277+
1278+
export type jsonb_expr = primary_array_index | binary_expr;
12551279

12561280
export type string_constants_escape = { type: 'origin'; value: string; };
12571281

@@ -1370,6 +1394,10 @@ export type aggr_array_agg = { type: 'aggr_func'; args:count_arg; name: 'ARRAY_A
13701394

13711395
export type star_expr = { type: 'star'; value: '*' };
13721396

1397+
export type position_func_args = expr_list;
1398+
1399+
export type position_func_clause = { type: 'function'; name: string; args: expr_list; };
1400+
13731401
export type trim_position = "BOTH" | "LEADING" | "TRAILING";
13741402

13751403
export type trim_rem = expr_list;
@@ -1386,7 +1414,7 @@ export type make_interval_func_args = make_interval_func_args_item[] | expr_list
13861414

13871415
export type make_interval_func_clause = { type: 'function'; name: proc_func_name; args: make_interval_func_args; };
13881416

1389-
export type func_call = trim_func_clause | tablefunc_clause | substring_funcs_clause | make_interval_func_clause | { type: 'function'; name: proc_func_name; args: expr_list; suffix: literal_string; } | { type: 'function'; name: proc_func_name; args: expr_list; over?: over_partition; } | extract_func | { type: 'function'; name: proc_func_name; over?: on_update_current_timestamp; } | { type: 'function'; name: proc_func_name; args: expr_list; };
1417+
export type func_call = position_func_clause | trim_func_clause | tablefunc_clause | substring_funcs_clause | make_interval_func_clause | { type: 'function'; name: proc_func_name; args: expr_list; suffix: literal_string; } | { type: 'function'; name: proc_func_name; args: expr_list; over?: over_partition; } | extract_func | { type: 'function'; name: proc_func_name; over?: on_update_current_timestamp; } | { type: 'function'; name: proc_func_name; args: expr_list; };
13901418

13911419
export type extract_filed = 'string';
13921420

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-sql-parser",
3-
"version": "5.3.9",
3+
"version": "5.3.10",
44
"description": "simple node sql parser",
55
"main": "index.js",
66
"types": "types.d.ts",

0 commit comments

Comments
 (0)