Selection
In this section we'll learn how to select nodes and edges for our queries.
Select Attributes#
We use the Select function to select the attributes for our nodes:
produces:
Query edges#
If we want to query fields that are nested we use the Edge function
produces
The first parameter of the Edge function must be the full path starting from its upmost ancestor.
Using a slice syntax
If you prefer using a slice syntax over the conventional string (using the symbol ->)
you can instead use EdgePath([]string{"favorite_food", ...}) or Edge(dqlx.EdgePath([]string{"favorite_food", ...}))
Aliases#
In Order to alias a field you can simply use the expression alias:field
or use the function Alias
Select API#
You have few ways to select fields
Template literal#
Most of the examples we've seen so far uses the template literal for defining fields.
The newline is the delimiter for the next field