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

Easy way to read data page by page #213

Open
Tigrov opened this issue Nov 27, 2024 · 4 comments
Open

Easy way to read data page by page #213

Tigrov opened this issue Nov 27, 2024 · 4 comments
Labels
type:enhancement Enhancement
Milestone

Comments

@Tigrov
Copy link
Member

Tigrov commented Nov 27, 2024

As an example

$query = (new Query($db))->from('customer');
$dataReader = (new QueryDataReader($query))->withSort(Sort::only(['id']));
$paginator = (new KeysetPaginator($dataReader))->withPageSize(1000);

while ($dataReader = $paginator->nextDataReader()) {
  foreach ($dataReader->read() as $data) {
    // work with $data
  }
}
@samdark
Copy link
Member

samdark commented Dec 6, 2024

I'd name the method nextPage() or nextPageReader().

@vjik
Copy link
Member

vjik commented Dec 6, 2024

… or nextPaginator()

@samdark
Copy link
Member

samdark commented Dec 6, 2024

Should the instance returned be paginator?

@vjik
Copy link
Member

vjik commented Dec 6, 2024

No. It's can be any data reader. My idea is bad.

@samdark samdark added the type:enhancement Enhancement label Dec 7, 2024
@samdark samdark modified the milestones: 1.1, 2.0, 2.1 Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants