rhombic
Version:
SQL parsing, lineage extraction and manipulation
53 lines • 1.43 kB
TypeScript
/**
* Filter tree representation.
*
* For example, the following string:
* `tejas = 'chicken' AND slava = 'coffee'`
* will be represents with the following object:
* ```
* [
* {type: "predicate", dimension: "tejas", operator: "=", value: "chicken"},
* {type: "operator", operator: "and"},
* {type: "predicate", dimension: "slava", operator: "=", value: "coffee"}
* ]
* ```
*/
export declare type FilterTree = FilterTreeNode[];
/**
* List of valid operators
*/
export declare type Operator = "=" | ">" | ">=" | "<" | "<=" | "!=" | "is null" | "is not null" | "not in" | "in" | "like";
/**
* Predicate node
*/
export interface FilterTreePredicateNode {
type: "predicate";
dimension: string;
operator: Operator;
value?: string;
}
/**
* Operator node
*/
export interface FilterTreeOperatorNode {
type: "operator";
closeParentheses: number[];
operator?: "and" | "or";
openParentheses: number[];
}
/**
* Generic Filter tree node
*/
export declare type FilterTreeNode = FilterTreePredicateNode | FilterTreeOperatorNode;
/**
* Returns `true` if the node is an operator.
*
* @param node
*/
export declare const isOperator: (node: FilterTreeNode) => node is FilterTreeOperatorNode;
/**
* Returns `true` if the node is a predicate
* @param node
*/
export declare const isPredicate: (node: FilterTreeNode) => node is FilterTreePredicateNode;
//# sourceMappingURL=FilterTree.d.ts.map