Query Variables
In this section we'll learn how to create and use Query Variables
#
Defining Query VariableThis time let's start explaining variables in dqlx starting from a plain DQL statement.
then you will write the variable this way
If you want to add a variable on an edge you'll use EdgeAs()
function, For example:
You'll write
#
Use the variableTo use a variable within a query is super simple, just add the variable to a query using the Variable()
method
then refer to it with the P
function (P
stands for Predicate).
- dqlx
- dql
#
Value VariablesValue variables store scalar values. Value variables are a map from the UIDs of the enclosing block to the corresponding values.
Value variables are used by extracting the values with val(var-name)
, or by extracting the UIDs with uid(var-name)
.
To use value variables you can simply use the Val()
function
- dqlx
- dql