sql-parser-cst
Advanced tools
Comparing version 0.12.1 to 0.13.0
@@ -5,6 +5,6 @@ import { BaseNode, Keyword } from "./Base"; | ||
import { DataType } from "./DataType"; | ||
import { Expr, Identifier, ListExpr, ParenExpr, EntityName } from "./Expr"; | ||
import { Expr, Identifier, ListExpr, ParenExpr, EntityName, FuncCall } from "./Expr"; | ||
import { AsClause, WithConnectionClause } from "./ProcClause"; | ||
import { ClusterByClause, ForSystemTimeAsOfExpr, PartitionByClause, SubSelect } from "./Select"; | ||
export type AllCreateTableNodes = CreateTableStmt | ColumnDefinition | TableOption | CreateTableLikeClause | CreateTableCopyClause | CreateTableCloneClause | WithPartitionColumnsClause; | ||
export type AllCreateTableNodes = CreateTableStmt | ColumnDefinition | TableOption | CreateTableLikeClause | CreateTableCopyClause | CreateTableCloneClause | WithPartitionColumnsClause | CreateTableUsingClause; | ||
export interface CreateTableStmt extends BaseNode { | ||
@@ -17,2 +17,3 @@ type: "create_table_stmt"; | ||
snapshotKw?: Keyword<"SNAPSHOT">; | ||
virtualKw?: Keyword<"VIRTUAL">; | ||
tableKw: Keyword<"TABLE">; | ||
@@ -40,3 +41,3 @@ ifNotExistsKw?: [Keyword<"IF">, Keyword<"NOT">, Keyword<"EXISTS">]; | ||
type TableOptionValueMysql = Keyword<"DEFAULT" | "DYNAMIC" | "FIXED" | "COMPRESSED" | "REDUNDANT" | "COMPACT" | "NO" | "FIRST" | "LAST">; | ||
type CreateTableClause = AsClause<SubSelect> | CreateTableLikeClause | BigqueryCreateTableClause; | ||
type CreateTableClause = AsClause<SubSelect> | CreateTableLikeClause | BigqueryCreateTableClause | SqliteCreateTableClause; | ||
export interface CreateTableLikeClause extends BaseNode { | ||
@@ -67,2 +68,8 @@ type: "create_table_like_clause"; | ||
} | ||
type SqliteCreateTableClause = CreateTableUsingClause; | ||
export interface CreateTableUsingClause extends BaseNode { | ||
type: "create_table_using_clause"; | ||
usingKw: Keyword<"USING">; | ||
module: FuncCall; | ||
} | ||
export {}; |
@@ -6,4 +6,4 @@ import { AllColumns, BaseNode, Empty, Keyword } from "./Base"; | ||
import { LimitClause, OrderByClause, SubSelect, WhereClause, WindowDefinition } from "./Select"; | ||
export type AllExprNodes = Expr | FuncArgs | NamedArg | CastArg | CastFormat | ExtractFrom | FilterArg | OverArg | CaseWhen<Expr | Program> | CaseElse<Expr | Program> | IntervalUnitRange | PairExpr | WeekExpr | ArraySubscript | ArraySubscriptSpecifier; | ||
export type Expr = ListExpr | ParenExpr | BinaryExpr | PrefixOpExpr | PostfixOpExpr | FuncCall | CastExpr | RaiseExpr | ExtractExpr | BetweenExpr | CaseExpr | IntervalExpr | StringWithCharset | Literal | MemberExpr | BigQueryQuotedMemberExpr | Identifier | Parameter | TypedExpr | ArrayExpr | StructExpr; | ||
export type AllExprNodes = Expr | FuncArgs | NamedArg | CastArg | CastFormat | CastFormatTimezone | RaiseExprType | ExtractFrom | FilterArg | OverArg | CaseWhen<Expr | Program> | CaseElse<Expr | Program> | IntervalUnitRange | PairExpr | WeekExpr | ArraySubscript | ArraySubscriptSpecifier; | ||
export type Expr = ListExpr | ParenExpr | BinaryExpr | PrefixOpExpr | PostfixOpExpr | FuncCall | CastExpr | RaiseExpr | ExtractExpr | BetweenExpr | CaseExpr | IntervalExpr | StringWithCharset | Literal | MemberExpr | BigQueryQuotedMemberExpr | Identifier | Variable | Parameter | TypedExpr | ArrayExpr | StructExpr; | ||
export interface ListExpr<T = Node> extends BaseNode { | ||
@@ -86,8 +86,18 @@ type: "list_expr"; | ||
string: Expr; | ||
timezone?: CastFormatTimezone; | ||
} | ||
export interface CastFormatTimezone extends BaseNode { | ||
type: "cast_format_timezone"; | ||
atTimeZoneKw: [Keyword<"AT">, Keyword<"TIME">, Keyword<"ZONE">]; | ||
timezone: StringLiteral; | ||
} | ||
export interface RaiseExpr extends BaseNode { | ||
type: "raise_expr"; | ||
raiseKw: Keyword<"RAISE">; | ||
args: ParenExpr<ListExpr<Keyword<"IGNORE" | "ROLLBACK" | "ABORT" | "FAIL"> | StringLiteral>>; | ||
args: ParenExpr<ListExpr<RaiseExprType | StringLiteral>>; | ||
} | ||
export interface RaiseExprType extends BaseNode { | ||
type: "raise_expr_type"; | ||
typeKw: Keyword<"IGNORE" | "ROLLBACK" | "ABORT" | "FAIL">; | ||
} | ||
export interface ExtractExpr extends BaseNode { | ||
@@ -178,2 +188,7 @@ type: "extract_expr"; | ||
} | ||
export interface Variable extends BaseNode { | ||
type: "variable"; | ||
text: string; | ||
name: string; | ||
} | ||
export interface Parameter extends BaseNode { | ||
@@ -180,0 +195,0 @@ type: "parameter"; |
import { BaseNode, Keyword } from "./Base"; | ||
import { Expr, FuncCall, Identifier, ParenExpr, EntityName } from "./Expr"; | ||
import { Expr, Identifier, ParenExpr, EntityName } from "./Expr"; | ||
import { Literal, StringLiteral } from "./Literal"; | ||
export type AllSqliteNodes = AllSqliteStatements | PragmaAssignment | PragmaFuncCall; | ||
export type AllSqliteStatements = AttachDatabaseStmt | DetachDatabaseStmt | VacuumStmt | ReindexStmt | PragmaStmt | CreateVirtualTableStmt; | ||
export type AllSqliteStatements = AttachDatabaseStmt | DetachDatabaseStmt | VacuumStmt | ReindexStmt | PragmaStmt; | ||
export interface AttachDatabaseStmt extends BaseNode { | ||
@@ -47,13 +47,1 @@ type: "attach_database_stmt"; | ||
} | ||
export interface CreateVirtualTableStmt extends BaseNode { | ||
type: "create_virtual_table_stmt"; | ||
createVirtualTableKw: [ | ||
Keyword<"CREATE">, | ||
Keyword<"VIRTUAL">, | ||
Keyword<"TABLE"> | ||
]; | ||
ifNotExistsKw?: [Keyword<"IF">, Keyword<"NOT">, Keyword<"EXISTS">]; | ||
name: EntityName; | ||
usingKw: Keyword<"USING">; | ||
module: FuncCall; | ||
} |
@@ -14,4 +14,2 @@ import { BaseNode, Keyword } from "./Base"; | ||
event: TriggerEvent; | ||
onKw: Keyword<"ON">; | ||
table: EntityName; | ||
forEachRowKw?: [Keyword<"FOR">, Keyword<"EACH">, Keyword<"ROW">]; | ||
@@ -27,2 +25,4 @@ condition?: TriggerCondition; | ||
columns?: ListExpr<Identifier>; | ||
onKw: Keyword<"ON">; | ||
table: EntityName; | ||
} | ||
@@ -29,0 +29,0 @@ export interface TriggerCondition extends BaseNode { |
@@ -122,2 +122,3 @@ "use strict"; | ||
node.snapshotKw, | ||
node.virtualKw, | ||
node.tableKw, | ||
@@ -166,2 +167,3 @@ node.ifNotExistsKw, | ||
with_partition_columns_clause: (node) => show([node.withPartitionColumnsKw, node.columns]), | ||
create_table_using_clause: (node) => show([node.usingKw, node.module]), | ||
bigquery_options: (node) => show([node.optionsKw, node.options]), | ||
@@ -353,4 +355,2 @@ bigquery_option_default_collate: (node) => show([node.defaultCollateKw, node.collation]), | ||
node.event, | ||
node.onKw, | ||
node.table, | ||
node.forEachRowKw, | ||
@@ -360,3 +360,10 @@ node.condition, | ||
]), | ||
trigger_event: (node) => show([node.timeKw, node.eventKw, node.ofKw, node.columns]), | ||
trigger_event: (node) => show([ | ||
node.timeKw, | ||
node.eventKw, | ||
node.ofKw, | ||
node.columns, | ||
node.onKw, | ||
node.table, | ||
]), | ||
trigger_condition: (node) => show([node.whenKw, node.expr]), | ||
@@ -450,9 +457,2 @@ // DROP TRIGGER | ||
pragma_func_call: (node) => show([node.name, node.args]), | ||
create_virtual_table_stmt: (node) => show([ | ||
node.createVirtualTableKw, | ||
node.ifNotExistsKw, | ||
node.name, | ||
node.usingKw, | ||
node.module, | ||
]), | ||
// BigQuery-specific statements | ||
@@ -518,4 +518,6 @@ create_capacity_stmt: (node) => show([node.createKw, node.name, node.asKw, node.json]), | ||
cast_arg: (node) => show([node.expr, node.asKw, node.dataType, node.format]), | ||
cast_format: (node) => show([node.formatKw, node.string]), | ||
cast_format: (node) => show([node.formatKw, node.string, node.timezone]), | ||
cast_format_timezone: (node) => show([node.atTimeZoneKw, node.timezone]), | ||
raise_expr: (node) => show([node.raiseKw, node.args]), | ||
raise_expr_type: (node) => show(node.typeKw), | ||
extract_expr: (node) => show([node.extractKw, node.args]), | ||
@@ -568,4 +570,5 @@ extract_from: (node) => show([node.unit, node.fromKw, node.expr]), | ||
null_literal: (node) => show(node.nullKw), | ||
variable: (node) => node.text, | ||
parameter: (node) => node.text, | ||
// Cast to FullTransformMap, so TypeScript ensures all node types are covered | ||
}); |
@@ -5,3 +5,3 @@ { | ||
"license": "GPL-2.0-or-later", | ||
"version": "0.12.1", | ||
"version": "0.13.0", | ||
"main": "lib/main.js", | ||
@@ -8,0 +8,0 @@ "types": "lib/main.d.ts", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2164880
66113