romshark commented :
I think I faced a similar problem working on my dgraph tech-demo. I’m trying to implement pagination and this is the query I assumed to work:
query PostsPage(
$first: int = 4,
$id: string = "ce9f834c2fd143e7a0994cd01564d990"
) {
var(func: eq(Post.id, $id)) {
p as uid
}
posts(
func: has(Post.id),
orderasc: Post.id,
after: val(p),
first: $first
) {
uid
Post.id
Post.title
Post.contents
}
}
Unfortunately, it seems like I can’t use p as an argument for after:
": strconv.ParseUint: parsing \"p\": invalid syntax"
I suddenly need 2 roundtrips to get the job done:
- fetch the
uidbyid - then fetch the page using the
uid
This is obviously bad because it could have been done with just a single simple query.
Please correct me if I’m wrong.