Skip to content

Commit c4095ea

Browse files
committed
refactor: update ts
1 parent 96db75a commit c4095ea

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

.github/workflows/npm-publish-github-packages.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
env:
4646
NODE_AUTH_TOKEN: ${{secrets.PUBLISH_NPM_TOKEN}}
4747
- run: cd output/prod && npm publish
48+
env:
49+
NODE_AUTH_TOKEN: ${{secrets.PUBLISH_NPM_TOKEN}}
4850

4951
publish-gpr:
5052
needs: build
@@ -75,3 +77,5 @@ jobs:
7577
env:
7678
NODE_AUTH_TOKEN: ${{secrets.PUBLISH_GITHUB_TOKEN}}
7779
- run: cd output/prod && npm publish
80+
env:
81+
NODE_AUTH_TOKEN: ${{secrets.PUBLISH_GITHUB_TOKEN}}

ast/postgresql.ts

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,16 @@ export interface drop_index_stmt_node {
299299

300300
export type drop_stmt = AstStatement<drop_stmt_node> | AstStatement<drop_index_stmt_node>;
301301

302+
export type truncate_table_name = table_name & { suffix?: string };
303+
304+
export type truncate_table_name_list = truncate_table_name[];
305+
302306
export interface truncate_stmt_node {
303307
type: 'trucate';
304308
keyword: 'table';
309+
prefix?: string;
305310
name: table_ref_list;
311+
suffix: string[];
306312
}
307313

308314
export type truncate_stmt = AstStatement<truncate_stmt_node>;
@@ -559,7 +565,7 @@ export type table_option = {
559565
keyword: 'auto_increment' | 'avg_row_length' | 'key_block_size' | 'max_rows' | 'min_rows' | 'stats_sample_pages';
560566
symbol: '=';
561567
value: number; // <== literal_numeric['value']
562-
} | create_option_character_set | { keyword: 'connection' | 'comment'; symbol: '='; value: string; } | { keyword: 'compression'; symbol: '='; value: "'ZLIB'" | "'LZ4'" | "'NONE'" } | { keyword: 'engine'; symbol: '='; value: string; };
568+
} | create_option_character_set | { keyword: 'connection' | 'comment'; symbol: '='; value: string; } | { keyword: 'compression'; symbol?: '='; value: "'ZLIB'" | "'LZ4'" | "'NONE'" } | { keyword: 'engine'; symbol?: '='; value: string; } | { keyword: 'partition by'; value: expr; };
563569

564570
export type ALTER_ADD_FULLETXT_SPARITAL_INDEX = create_fulltext_spatial_index_definition & { action: 'add'; type: 'alter' };
565571

@@ -770,6 +776,8 @@ export type column_clause = 'ALL' | '*' | column_list_item[] | column_list_item[
770776

771777
export type array_index = { brackets: boolean, number: number };
772778

779+
export type array_index_list = array_index[];
780+
773781
export type expr_item = binary_expr & { array_index: array_index };
774782

775783
export type cast_data_type = data_type & { quoted?: string };
@@ -881,7 +889,7 @@ export type window_frame_value = literal_string | literal_numeric;
881889

882890

883891

884-
export type partition_by_clause = column_clause;
892+
export type partition_by_clause = { type: 'expr'; expr: column_ref_list }[];
885893

886894

887895

@@ -1103,32 +1111,38 @@ export type column_ref = string_constants_escape | {
11031111
property?: (literal_string | literal_numeric)[];
11041112
};
11051113

1114+
export type column_ref_quoted = IGNORE;
1115+
11061116
export type column_list = column[];
11071117

1118+
export type ident_without_kw_type = { type: 'default', value: string } | quoted_ident_type;
1119+
1120+
export type ident_type = ident_name | quoted_ident_type;
1121+
11081122
export type ident = string;
11091123

11101124
export type ident_list = ident[];
11111125

11121126
export type alias_ident = string;
11131127

1114-
export type quoted_ident = double_quoted_ident | single_quoted_ident | backticks_quoted_ident;
1115-
1116-
1128+
export type quoted_ident_type = double_quoted_ident | single_quoted_ident | backticks_quoted_ident;
11171129

1118-
export type double_quoted_ident = string;
1130+
export type quoted_ident = string;
11191131

1132+
export type double_quoted_ident = { type: 'double_quote_string'; value: string; };
11201133

1134+
export type single_quoted_ident = { type: 'single_quote_string'; value: string; };
11211135

1122-
export type single_quoted_ident = string;
1123-
1124-
1125-
1126-
export type backticks_quoted_ident = string;
1136+
export type backticks_quoted_ident = { type: 'backticks_quote_string'; value: string; };
11271137

11281138
export type ident_without_kw = ident_name | quoted_ident;
11291139

11301140
export type column_without_kw = column_name | quoted_ident;
11311141

1142+
export type column_without_kw_type = { type: 'default', value: string } | quoted_ident_type;
1143+
1144+
export type column_type = { type: 'default', value: string } | quoted_ident_type;
1145+
11321146

11331147

11341148
export type column = string | quoted_ident;
@@ -1199,11 +1213,11 @@ export type trim_position = "BOTH" | "LEADING" | "TRAILING";
11991213

12001214
export type trim_rem = expr_list;
12011215

1202-
export type trim_func_clause = { type: 'function'; name: string; args: expr_list; };
1216+
export type trim_func_clause = { type: 'function'; name: proc_func_name; args: expr_list; };
12031217

1204-
export type tablefunc_clause = { type: 'tablefunc'; name: crosstab; args: expr_list; as: func_call };
1218+
export type tablefunc_clause = { type: 'tablefunc'; name: proc_func_name; args: expr_list; as: func_call };
12051219

1206-
export type func_call = trim_func_clause | tablefunc_clause | { type: 'function'; name: string; args: expr_list; suffix: literal_string; } | { type: 'function'; name: string; args: expr_list; over?: over_partition; } | extract_func | { type: 'function'; name: string; over?: on_update_current_timestamp; } | { type: 'function'; name: string; args: expr_list; };
1220+
export type func_call = trim_func_clause | tablefunc_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; };
12071221

12081222
export type extract_filed = 'string';
12091223

@@ -1262,7 +1276,9 @@ export type literal_not_null = { type: 'not null'; value: 'not null' };
12621276

12631277
export type literal_bool = { type: 'bool', value: true } | { type: 'bool', value: false };
12641278

1265-
export type literal_string = { type: 'single_quote_string'; value: string; } | { type: 'string'; value: string; };
1279+
export type literal_string = { type: 'single_quote_string'; value: string; } | literal_double_quoted_string;
1280+
1281+
export type literal_double_quoted_string = { type: 'string'; value: string; };
12661282

12671283
export type literal_datetime = { type: 'TIME' | 'DATE' | 'TIMESTAMP' | 'DATETIME', value: string };
12681284

@@ -1730,7 +1746,7 @@ export type proc_join = { type: 'join'; ltable: var_decl; rtable: var_decl; op:
17301746

17311747
export type proc_primary = literal | var_decl | proc_func_call | param | proc_additive_expr & { parentheses: true; } | { type: 'var'; prefix: null; name: number; members: []; quoted: null } | column_ref;
17321748

1733-
export type proc_func_name = string;
1749+
export type proc_func_name = { schema?: ident_without_kw_type, name: ident_without_kw_type };
17341750

17351751
export type proc_func_call = { type: 'function'; name: string; args: null | { type: expr_list; value: proc_primary_list; }};
17361752

@@ -1831,4 +1847,6 @@ export type uuid_type = data_type;
18311847

18321848

18331849

1834-
export type record_type = data_type;
1850+
export type record_type = data_type;
1851+
1852+
export type custom_types = data_type;

0 commit comments

Comments
 (0)