graph-gophers / dataloader

Implementation of Facebook's DataLoader in Golang
MIT License
1.21k stars 75 forks source link

Example with a database and graphql #89

Open ViniciusAtaide opened 2 years ago

ViniciusAtaide commented 2 years ago

could you provide a simple example with any database using the IN clause?

I'm new to dataloader so I'm mostly deducing keys are each id that the resolver provides but I'm not sure.

Thank you

ViniciusAtaide commented 2 years ago

The returned value from the conversion from the database too would be nice to understand. I see a for casting one type to another but idk if the mapped result with a repository with id as keys and entities as values are an obligatory approach.

ViniciusAtaide commented 2 years ago

taking advantage of the thread may I ask too why in my application it is asking 5 as a string in this codeline https://github.com/graph-gophers/dataloader/blob/4611304016ff21691d98628cf0425274a5c961a6/example/no_cache/no_cache_test.go#L35

ViniciusAtaide commented 2 years ago

taking advantage of the thread may I ask too why in my application it is asking 5 as a string in this codeline

https://github.com/graph-gophers/dataloader/blob/4611304016ff21691d98628cf0425274a5c961a6/example/no_cache/no_cache_test.go#L35

just found out that was the same type of my key, uuid. that's why