Selection
In this section we'll learn how to select nodes and edges for our queries.
#
Select AttributesWe use the Select
function to select the attributes for our nodes:
produces:
#
Query edgesIf 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", ...}))
#
AliasesIn Order to alias a field you can simply use the expression alias:field
or use the function Alias
#
Select APIYou have few ways to select fields
#
Template literalMost of the examples we've seen so far uses the template literal for defining fields.
The newline is the delimiter for the next field