Bro, sometimes, only the comment to the right place is enough to point out the mistake, even if it is wrong. It’s enough to get the solution working.
You had correct logic, It should not be Users instead it should point to existing user and that is done using pointer.
So, I altered my code to
type Post struct {
UID string `json:"uid,omitempty"`
...
OwnerUserID *Users `json:"OwnerUserID,omitempty"`
...
}
and while pointing user doing -
p := Post{
...
OwnerUserID: &User{UID: "0x1"}, // & and * doing job.
...
}
Thanks bro for helping in finding the solution! You are one among the true gems in dgraph community.