[feature] uid_in query with QueryWithVars

Moved from GitHub dgraph/4890

Posted by u007:

is there any way to passing list of uid as string{} for QueryWithVars ?

srfrog commented :

@u007 how would this work? The reason we use map is to match var name to value. If we send a slice, then we would need to create var-names. Correct? Please show a use case of this.

u007 commented :

hi @srfrog ,
maybe something like

uid_in(field, ["0x878110", "0x06"])

or in go

values = []string{"0x878110", "0x06"}
uid_in(field, $values)

mangalaman93 commented :

related to queryWithVars -- how to specify multiple uids? · Issue #97 · dgraph-io/dgraph4j · GitHub

MichelDiz commented :

it is already possible to do

follows @filter(uid_in(~follows, [0x1d, 0x1e, 0x20, 0x21])) 

unfortunately, you can’t do:

follows @filter(uid_in(~follows, $uids)) 

with multiple uids. Pinging @anurags92

you can do

follows @filter(uid_in(~follows, [$uids]))
#Message: : Value "0x1d, 0x1e, 0x20, 0x21" in uid_in is not a number

but even so, you can add multiple uids in the GraphQL Query.

Also, it is not possible to force the pseudo-array in the GraphQL Query:

query query($uids: string = "[0x1d, 0x1e, 0x20, 0x21]") {
  query(func: has(follows)) @cascade
      follows @filter(uid_in(~follows, $uids))