Skip to content

[v1.23] Testing the new iter package with gh-iter #3209

@enrichman

Description

@enrichman

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions