dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

[feature] uid_in query with QueryWithVars

Open u007 opened this issue 6 years ago • 5 comments

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

u007 avatar Nov 21 '18 14:11 u007

@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.

srfrog avatar Jan 23 '19 01:01 srfrog

hi @srfrog , maybe something like

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

or in go

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

u007 avatar Jan 23 '19 05:01 u007

related to https://github.com/dgraph-io/dgraph4j/issues/97

mangalaman93 avatar Sep 18 '19 10:09 mangalaman93

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
    {
    uid
      follows @filter(uid_in(~follows, $uids)) 
      {
        uid
      }
  }
}

MichelDiz avatar Jun 18 '20 22:06 MichelDiz

Github issues have been deprecated. This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.

drawing

minhaj-shakeel avatar Jul 20 '20 19:07 minhaj-shakeel