Skip to content

Commit

Permalink
Merge pull request #1828 from darz-io/refactor-quoted-func-name
Browse files Browse the repository at this point in the history
refactor: new function name types
  • Loading branch information
taozhi8833998 authored Mar 17, 2024
2 parents ccd5cfb + 2d3e8a0 commit 2696e3e
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ export interface OrderBy {
type: "ASC" | "DESC";
expr: any;
}

export interface ValueExpr<T = string | number | boolean> {
type: "backticks_quote_string" | "string" | "regex_string" | "hex_string" | "full_hex_string" | "natural_string" | "bit_string" | "double_quote_string" | "single_quote_string" | "boolean" | "bool" | "null" | "star" | "param" | "origin" | "date" | "datetime" | "time" | "timestamp" | "var_string";
value: T;
}

export interface ColumnRef {
type: "column_ref";
table: string | null;
column: string;
column: string | { expr: ValueExpr };
}
export interface SetList {
column: string;
Expand All @@ -63,9 +69,11 @@ export interface AggrFunc {
name: string;
args: ColumnRef | AggrFunc | Star | null;
}

export type FunctionName = { schema?: string, name: ValueExpr<string>[] }
export interface Function {
type: "function";
name: string;
name: FunctionName;
args: ExprList;
suffix?: any;
}
Expand All @@ -81,17 +89,17 @@ type Value = { type: string; value: any };

export type Expr =
| {
type: "binary_expr";
operator: "AND" | "OR";
left: Expr;
right: Expr;
}
type: "binary_expr";
operator: "AND" | "OR";
left: Expr;
right: Expr;
}
| {
type: "binary_expr";
operator: string;
left: ColumnRef | Param | Value;
right: ColumnRef | Param | Value;
};
type: "binary_expr";
operator: string;
left: ColumnRef | Param | Value;
right: ColumnRef | Param | Value;
};

export type ExprList = {
type: "expr_list";
Expand Down

0 comments on commit 2696e3e

Please sign in to comment.