I would have raised this in dgo, but it looks like it could be more to do with the parser. I saw that even though you have to pass a map[string]string into QueryWithVars, if you specify it as an int in withvar(), it should be able to take it.
Code ref: https://github.com/dgraph-io/dgraph/blob/master/gql/parser.go#L303
-
What version of Dgraph are you using?
1.0.14
-
Have you tried reproducing the issue with latest release?
yes
-
What is the hardware spec (RAM, OS)?
rd5.large
-
Steps to reproduce the issue (command/config used to run Dgraph).
You can only pass a string map as the variables map.
queryDepth := strconv.Itoa(1)
variables := map[string]string{"$id": Id, "$depth": queryDepth}
q := `query withvar($id: string, $depth: int){
result(func: eq(id, $id)) @recurse(depth: $depth, loop: false){
id
links
}
}`
resp, err := txn.QueryWithVars(*ctx, q, variables)
- Expected behaviour and actual result.
Error: Expected value inside @recurse() for key: depth
I would have raised this in dgo, but it looks like it could be more to do with the parser. I saw that even though you have to pass a
map[string]stringintoQueryWithVars, if you specify it as an int inwithvar(), it should be able to take it.Code ref: https://github.com/dgraph-io/dgraph/blob/master/gql/parser.go#L303
What version of Dgraph are you using?
1.0.14
Have you tried reproducing the issue with latest release?
yes
What is the hardware spec (RAM, OS)?
rd5.large
Steps to reproduce the issue (command/config used to run Dgraph).
You can only pass a string map as the variables map.
Error:
Expected value inside @recurse() for key: depth