Moved from GitHub dgraph/2726
Posted by F21:
Experience Report
I often have queries where I want to match a list of things (similar to an IN
query in SQL). For example:
{
someQuery(func: eq(somePredicate, val1, val2){
someField
}
}
Often, these values come from user input and I want to pass these values to the query using query variables.
Effectively, this would allow a query like so:
query($vals: []string){
someQuery(func: eq(somePredicate, $vals){
someField
}
}
What you wanted to do
I wanted to pass a list of values as a query variable into a query.
What you actually did
I had to create the query programmatically using string concatenation.
Why that wasn’t great, with examples
Having to use string concatenation introduced a lot of noise into the code and the query was very unreadable.
Any external references to support your case
None.