-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparameters.d.ts
103 lines (88 loc) · 1.91 KB
/
parameters.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
class Parameter {
joinSelection: Array<Join>;
wherePredicateSelection: [Condition<ScalarComparisonPredicate>] | Array<Conjunction<ScalarComparisonPredicate>>;
columnSelection: Array<Column>;
havingPredicateSelection:
| [Condition<NumericalComparisonPredicate>]
| Array<Conjunction<NumericalComparisonPredicate>>;
groupBy: Boolean;
orderBy: Boolean;
seed?: string | null;
schema?: string;
}
class Join {
joinType: JoinType;
predicate?: NumericalComparisonPredicate.Equal;
target?: JoinTarget;
}
class Condition<P extends Predicate> {
predicate: P;
}
class Conjunction<P extends Predicate> {
conjunctionType?: ConjunctionType;
conditions?: [Condition<P>, Condition<P>];
}
class Column {
columnType?: ColumnType;
aggregateFunction?: AggregateFunction;
}
enum AggregateFunction {
"Count",
"Sum",
"Average",
"Min",
"Max",
"Any",
}
enum ColumnType {
"ID",
"String",
"Date",
"Numeric",
}
enum JoinTarget {
"Table",
"Subquery",
"Self",
}
enum JoinType {
"Left Inner Join",
"Right Inner Join",
"Inner Join",
"Left Outer Join",
"Right Outer Join",
"Outer Join",
"Cross Join",
}
enum ConjunctionType {
"AND",
"OR",
}
type Predicate = ScalarComparisonPredicate | VectorComparisonPredicate;
type ScalarComparisonPredicate = StringComparisonPredicate | NumericalComparisonPredicate | RangeComparisonPredicate;
enum StringComparisonPredicate {
"Like" = "LIKE",
"Not Like" = "NOT LIKE",
}
enum NumericalComparisonPredicate {
"Equal" = "=",
"Not Equal" = "<>",
"Greater Than" = ">",
"Less Than" = "<",
"Greater Than Or Equal" = ">=",
"Less Than Or Equal" = "<=",
}
enum RangeComparisonPredicate {
"Between" = "BETWEEN",
"Not Between" = "NOT BETWEEN",
}
// exemplary extension point
class SubQueryCondition {
predicate: ScalarComparisonPredicate | VectorComparisonPredicate;
}
enum VectorComparisonPredicate {
"In" = "IN",
"Not In" = "NOT IN",
"Is Null" = "IS NULL",
"Is Not Null" = "IS NOT NULL",
}