Skip to content

Update README with modern pagination helper#874

Open
nicois wants to merge 1 commit into
digitalocean:mainfrom
nicois:main
Open

Update README with modern pagination helper#874
nicois wants to merge 1 commit into
digitalocean:mainfrom
nicois:main

Conversation

@nicois
Copy link
Copy Markdown

@nicois nicois commented Jul 18, 2025

Instead of requiring consumers of godo to hand-craft separate wrapper functions for each paginated List* function, demonstrate how to use golang generics to write a single helper.

Additionally, use the slices pattern to avoid wasteful memory usage buffering responses, and demonstrate how this can also work for List* functions which require an additional argument.

Fixes #861

@nicois nicois marked this pull request as ready for review July 18, 2025 01:43
@nicois
Copy link
Copy Markdown
Author

nicois commented Jul 18, 2025

While something similar could easily be done to handle token-based pagination, there is only a single function which uses this approach so the existing example is sufficient.

Instead of requiring consumers of godo to hand-craft separate
wrapper functions for each paginated List* function, demonstrate
how to use golang generics to write a single helper.

Additionally, use the slices pattern to avoid wasteful memory usage
buffering responses, and demonstrate how this can also work for
List* functions which require an additional argument.
@nicois
Copy link
Copy Markdown
Author

nicois commented Sep 3, 2025

@SSharma-10 you merged the main branch into this PR last month. I'm not sure that's what you intended to do. I rebased this commit off the current main commit; can you please re-review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include more modern example of handling pagination

2 participants