Skip to content

Commit

Permalink
refactor: upgrade version
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhi8833998 committed Dec 13, 2023
1 parent 7e5e2dc commit 12198a1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ast/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,9 @@ export type trim_rem = expr_list;

export type trim_func_clause = { type: 'function'; name: string; args: expr_list; };

export type func_call = trim_func_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; };
export type tablefunc_clause = { type: 'tablefunc'; name: crosstab; args: expr_list; as: func_call };

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; };

export type extract_filed = 'string';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-sql-parser",
"version": "4.12.0",
"version": "4.13.0",
"description": "simple node sql parser",
"main": "index.js",
"types": "types.d.ts",
Expand Down
1 change: 1 addition & 0 deletions pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -4313,6 +4313,7 @@ trim_func_clause

tablefunc_clause
= 'crosstab'i __ LPAREN __ s:literal_list __ RPAREN __ KW_AS __ 'final_result' LPAREN __ cds:column_data_type_list __ RPAREN {
// => { type: 'tablefunc'; name: crosstab; args: expr_list; as: func_call }
return {
type: 'tablefunc',
name: 'crosstab',
Expand Down
3 changes: 3 additions & 0 deletions test/bigquery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,9 @@ describe('BigQuery', () => {
value: 'abc'
}
expect(arrayStructValueToSQL(expr)).to.equal(`['${expr.expr_list.value}']`)
expr.brackets = false
expr.parentheses = false
expect(arrayStructValueToSQL(expr)).to.equal(`'${expr.expr_list.value}'`)
})

it('should return undefined and dataType', () => {
Expand Down

0 comments on commit 12198a1

Please sign in to comment.