data icon indicating copy to clipboard operation
data copied to clipboard

Easy way to read data page by page

Open Tigrov opened this issue 1 year ago • 4 comments

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
  }
}

Tigrov avatar Nov 27 '24 07:11 Tigrov

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

samdark avatar Dec 06 '24 06:12 samdark

… or nextPaginator()

vjik avatar Dec 06 '24 07:12 vjik

Should the instance returned be paginator?

samdark avatar Dec 06 '24 07:12 samdark

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

vjik avatar Dec 06 '24 12:12 vjik