|
16 | 16 | | entity | String | True | |
17 | 17 | | properties | List[`functions.*` `properties.Property` `structures.Distinct` `structures.CastOperator`] | True | |
18 | 18 | | joins | List[`structures.Join`] | False | |
19 | | -| conditions | `structures.Operator` | False | |
| 19 | +| conditions | `structures.Operator` `structures.Comparision` | False | |
20 | 20 | | order | List[`structures.Order`] | False | |
21 | 21 | | group | List[`functions.*` `properties.Property`] | False | |
| 22 | +| having | `structures.Operator` `structures.Comparision` | False | |
22 | 23 | | limit | `structures.Limit` | False | |
23 | 24 | | alias | String | False | |
24 | 25 |
|
|
31 | 32 | "properties": [ |
32 | 33 | { |
33 | 34 | "obj": "properties.Property", |
34 | | - "name": "users.name" |
| 35 | + "name": "users.name", |
| 36 | + "alias": "users_name" |
35 | 37 | }, |
36 | 38 | { |
37 | 39 | "obj": "functions.ConvertTimezone", |
38 | 40 | "property": { |
39 | 41 | "obj": "properties.Property", |
40 | | - "name": "users.created_at" |
| 42 | + "name": "users.created_at", |
| 43 | + "alias": null |
41 | 44 | }, |
42 | 45 | "date_from": { |
43 | 46 | "obj": "properties.Constant", |
|
46 | 49 | "date_to": { |
47 | 50 | "obj": "properties.Constant", |
48 | 51 | "value": "Europe/Bratislava" |
49 | | - } |
| 52 | + }, |
| 53 | + "alias": "valid_timezone" |
50 | 54 | } |
51 | 55 | ], |
52 | 56 | "joins": [ |
|
63 | 67 | "properties": [ |
64 | 68 | { |
65 | 69 | "obj": "properties.Property", |
66 | | - "name": "transactions.user_id" |
| 70 | + "name": "transactions.user_id", |
| 71 | + "alias": null |
67 | 72 | }, |
68 | 73 | { |
69 | 74 | "obj": "properties.Property", |
70 | | - "name": "users.id" |
| 75 | + "name": "users.id", |
| 76 | + "alias": null |
71 | 77 | } |
72 | 78 | ], |
73 | 79 | "operation": "eq" |
|
77 | 83 | "properties": [ |
78 | 84 | { |
79 | 85 | "obj": "properties.Property", |
80 | | - "name": "transactions.creator_id" |
| 86 | + "name": "transactions.creator_id", |
| 87 | + "alias": null |
81 | 88 | }, |
82 | 89 | { |
83 | 90 | "obj": "properties.Property", |
84 | | - "name": "users.id" |
| 91 | + "name": "users.id", |
| 92 | + "alias": null |
85 | 93 | } |
86 | 94 | ], |
87 | 95 | "operation": "neq" |
88 | 96 | } |
89 | | - ] |
90 | | - } |
| 97 | + ], |
| 98 | + "alias": null |
| 99 | + }, |
| 100 | + "alias": null |
91 | 101 | } |
92 | 102 | ], |
93 | 103 | "conditions": { |
|
99 | 109 | "properties": [ |
100 | 110 | { |
101 | 111 | "obj": "properties.Property", |
102 | | - "name": "users.age" |
| 112 | + "name": "users.age", |
| 113 | + "alias": null |
103 | 114 | }, |
104 | 115 | { |
105 | 116 | "obj": "properties.Constant", |
|
113 | 124 | "properties": [ |
114 | 125 | { |
115 | 126 | "obj": "properties.Property", |
116 | | - "name": "users.city" |
| 127 | + "name": "users.city", |
| 128 | + "alias": null |
117 | 129 | }, |
118 | 130 | { |
119 | 131 | "obj": "properties.Array", |
|
131 | 143 | ], |
132 | 144 | "operation": "in" |
133 | 145 | } |
134 | | - ] |
| 146 | + ], |
| 147 | + "alias": null |
| 148 | + }, |
| 149 | + "having": { |
| 150 | + "obj": "structures.Comparision", |
| 151 | + "properties": [ |
| 152 | + { |
| 153 | + "obj": "functions.Sum", |
| 154 | + "property": { |
| 155 | + "obj": "properties.Property", |
| 156 | + "name": "transactions.value", |
| 157 | + "alias": null |
| 158 | + }, |
| 159 | + "alias": null |
| 160 | + }, |
| 161 | + { |
| 162 | + "obj": "properties.Constant", |
| 163 | + "value": "420" |
| 164 | + } |
| 165 | + ], |
| 166 | + "operation": "gt" |
135 | 167 | }, |
136 | 168 | "order": [ |
137 | 169 | { |
138 | 170 | "obj": "structures.Order", |
139 | 171 | "property": { |
140 | 172 | "obj": "properties.Property", |
141 | | - "name": "users.surname" |
| 173 | + "name": "users.surname", |
| 174 | + "alias": null |
142 | 175 | }, |
143 | 176 | "kind": "ASC" |
144 | 177 | }, |
145 | 178 | { |
146 | 179 | "obj": "structures.Order", |
147 | 180 | "property": { |
148 | 181 | "obj": "properties.Property", |
149 | | - "name": "users.name" |
| 182 | + "name": "users.name", |
| 183 | + "alias": null |
150 | 184 | }, |
151 | 185 | "kind": "DESC" |
152 | 186 | } |
153 | 187 | ], |
154 | 188 | "group": [ |
155 | 189 | { |
156 | 190 | "obj": "properties.Property", |
157 | | - "name": "users.email" |
| 191 | + "name": "users.email", |
| 192 | + "alias": null |
158 | 193 | }, |
159 | 194 | { |
160 | 195 | "obj": "properties.Property", |
161 | | - "name": "users.id" |
| 196 | + "name": "users.id", |
| 197 | + "alias": null |
162 | 198 | } |
163 | 199 | ], |
164 | 200 | "limit": { |
|
187 | 223 | (users.age >= 15) |
188 | 224 | AND (users.city IN ('Martin', 'Bratislava')) |
189 | 225 | ) |
190 | | - GROUP BY users.email, |
191 | | - users.id |
192 | | - ORDER BY users.surname ASC, |
193 | | - users.name DESC |
| 226 | + GROUP BY users.email, users.id |
| 227 | + HAVING (SUM(transactions.value) > 420) |
| 228 | + ORDER BY users.surname ASC, users.name DESC |
194 | 229 | LIMIT 10 OFFSET 4 |
195 | 230 | ) |
196 | 231 | AS my_query |
197 | 232 | ``` |
198 | | - |
|
0 commit comments