graph-gophers / dataloader

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

Keys passed to batchFn can be sort by asc? #69

Closed KingWu closed 2 years ago

KingWu commented 4 years ago

Any way to sort the Keys passed to batchFn?

nicksrandall commented 3 years ago

You could sort the keys as the first step in your batch function if you need them sorted. An easy way to accomplish this would be to have your key interface also implement the sort.Interface interface so that you could sort the keys using the std lib.

pavelnikolov commented 2 years ago

This is not directly related to the library's functionality. @nicksrandall's solution seems good.