Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide pagination info when auto-pagination is enabled #1163

Open
favonia opened this issue Jan 4, 2023 · 0 comments
Open

Hide pagination info when auto-pagination is enabled #1163

favonia opened this issue Jan 4, 2023 · 0 comments

Comments

@favonia
Copy link
Contributor

favonia commented Jan 4, 2023

Current cloudflare-go version

0.54.0

Description

As mentioned in #612 (comment), I wonder if it makes sense for the functions with auto-pagination to return a modified ResultInfo saying that "there's only one big single page" (that is, Page is 1, TotalPages is 1, and Count matches Total, etc,).

Use cases

It should be an invariant that Count always matches the number of returned entries, hiding the details of pagination when auto-pagination is enabled.

Potential cloudflare-go usage

rs, ri, err := ListDNSRecords(ctx, ...)

// len(rs) == ri.Count should always hold whenever err == nil

References

This was discussed in #612. The discussion there was dismissed because we intended to enable auto-pagination unconditionally back then. However, the new API allows library users to turn off auto-pagination and thus the same design question re-appears.

@favonia favonia changed the title Modify returned ResultInfo when auto-pagination is enabled Modify returned ResultInfo when auto-pagination is enabled Jan 4, 2023
@favonia favonia changed the title Modify returned ResultInfo when auto-pagination is enabled Hide pagination info when auto-pagination is enabled Jan 4, 2023
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

No branches or pull requests

1 participant