-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
The incoming v1.23
Go version will introduce the iter
package, and tried to implement a generic wrapper around the client.
It support pagination in a transparent way, with generics:
// init your Github client
client := github.NewClient(nil)
// create an iterator, and start looping! 🎉
users := ghiter.NewFromFn(client.Users.ListAll)
for u := range users.All() {
fmt.Println(*u.Login)
}
https://github.com/enrichman/gh-iter
Maybe it can provides some hints about embedding this new feature into the official client, or if you are more about keeping the two separates then you are probably aware about some edge cases I'm not aware of.
For example I've read about some annoyance about the setting of the query parameters of the link
headers in some issues. I tried to use the reflect
package to dynamically set those in the provided options, checking the url
tag of the option fields.
Looking for feedbacks!
gmlewis and RickleAndMortimergmlewis
Metadata
Metadata
Assignees
Labels
No labels