QueryWithVars allows adding a map of variables that will be interpolated into the query. But this is not sufficient for functions that are variadic (i.e. uid).
Proposal
Add QueryWithListVars, which allows including a slice of elements instead of a map.
Looked a bit more. These Vars are evaluated by the parser on the server alpha side. As such, we would need to make changes on both the dgo as well as alpha dgraph side.
I don’t think it is trivial as it mucks with the parser. Let’s start with you creating an issue on GitHub at Issues · dgraph-io/dgraph · GitHub so it goes through our pipeline and prioritization.