Hey! I am currently struggling to implement datalo...
# orm-help
l
Hey! I am currently struggling to implement dataloader in a project where deep queries could occur, so I'm trying to circumvent the n+1 problem. I can't seem to find a method to implement dataloaders with GraphQL & Prisma in Go (github.com/vektah/dataloaden). I only have the ID from the current object:
Copy code
func (r *Resolver) Todo_userLoader(ctx context.Context, obj *Todo) (*User, error) {
	return ctx.Value(userLoaderKey).(*UserLoader).Load(<http://obj.xxx|obj.xxx>) // I only have obj.ID and no obj.UserID or something similar
}
I can't seem to find a way to find a working solution. I could create a UserLoaderBySession and load them with session IDs:
.(*UserLoader).Load(<http://obj.xxx|obj.xxx>)
, but when I provide todos belonging to the same user, my internal prisma where-or-query only returns unique results and since prisma doesn't return relation ids (like obj.UserID) I can't connect them to the session IDs afterwards (because dataloader expects 5 returned results when 5 ids are provided). Any suggestions?