You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For convenience, the query builder provides a shorthand for selecting all
112
+
properties of a given object.
113
+
114
+
.. code-block:: typescript
115
+
116
+
e.select(e.Movie, movie=> ({
117
+
...e.Movie['*']
118
+
}));
119
+
120
+
const result =awaitquery.run(client);
121
+
// {id: string; title: string; runtime: Date}[]
122
+
123
+
This ``*`` property is just a strongly-typed, plain object:
124
+
125
+
.. code-block::
126
+
127
+
e.Movie['*'];
128
+
// => {id: true, title: true, runtime: true}
129
+
130
+
109
131
Nesting shapes
132
+
^^^^^^^^^^^^^^
110
133
111
134
As in EdgeQL, shapes can be nested to fetch deeply related objects.
112
135
@@ -129,7 +152,7 @@ As in EdgeQL, shapes can be nested to fetch deeply related objects.
129
152
130
153
131
154
Why closures?
132
-
^^^^^^^^^^^^^
155
+
-------------
133
156
134
157
In EdgeQL, a ``select`` statement introduces a new *scope*; within the clauses
135
158
of a select statement, you can refer to fields of the *elements being
@@ -151,7 +174,7 @@ computed fields, and other expressions. Let's see it in action.
151
174
152
175
153
176
Filtering
154
-
^^^^^^^^^
177
+
---------
155
178
156
179
To add a filtering clause, just include a ``filter`` key in the returned
157
180
params object. This should correspond to a boolean expression.
@@ -176,7 +199,8 @@ params object. This should correspond to a boolean expression.
176
199
EdgeDB, there is minimal danger of conflicting with a property or link named
177
200
``filter``. All shapes can contain filter clauses, even nested ones.
178
201
179
-
### Nested filtering
202
+
Filters on links
203
+
----------------
180
204
181
205
.. code-block:: typescript
182
206
@@ -191,7 +215,7 @@ params object. This should correspond to a boolean expression.
191
215
192
216
193
217
Ordering
194
-
^^^^^^^^
218
+
--------
195
219
196
220
As with ``filter``, you can pass a value with the special ``order_by`` key. To
197
221
simply order by a property:
@@ -202,8 +226,6 @@ simply order by a property:
202
226
order_by: movie.title,
203
227
}));
204
228
205
-
206
-
207
229
.. note::
208
230
209
231
Unlike ``filter``, ``order_by`` is *not* a reserved word in EdgeDB. Using
@@ -277,7 +299,7 @@ Pass an array of objects to do multiple ordering.
277
299
278
300
279
301
Pagination
280
-
^^^^^^^^^^
302
+
----------
281
303
282
304
Use ``offset`` and ``limit`` to paginate queries. You can pass an expression
283
305
with an integer type or a plain JS number.
@@ -295,7 +317,7 @@ with an integer type or a plain JS number.
295
317
*/
296
318
297
319
Computeds
298
-
^^^^^^^^^
320
+
---------
299
321
300
322
To add a computed field, just add it to the returned shape alongside the other
301
323
elements. All reflected functions are typesafe, so the output type
@@ -339,7 +361,7 @@ signatures agree.
339
361
.. _ref_qb_polymorphism:
340
362
341
363
Polymorphism
342
-
^^^^^^^^^^^^
364
+
------------
343
365
344
366
EdgeQL supports polymorphic queries using the ``[is type]`` prefix.
345
367
@@ -373,7 +395,7 @@ fact that they will only occur in certain objects.
373
395
374
396
375
397
Detached
376
-
^^^^^^^^
398
+
--------
377
399
378
400
Sometimes you need to "detach" a set reference from the current scope. (Read the `reference docs <https://www.edgedb.com/docs/reference/edgeql/with#detached>`_ for details.) You can achieve this in the query builder with the top-level ``e.detached`` function.
0 commit comments