NAME
IO::Async::Pg::Cursor - Streaming cursor for large result sets
SYNOPSIS
my $cursor = await $conn->cursor(
'SELECT * FROM large_table WHERE status = $1',
'active',
{ batch_size => 100 }
);
# Iterate over batches
while (my $batch = await $cursor->next) {
for my $row (@$batch) {
process($row);
}
}
# Or use each() for row-by-row processing
await $cursor->each(sub {
my ($row) = @_;
process($row);
});
# Clean up
await $cursor->close;
METHODS
next
Fetch the next batch of rows. Returns arrayref of rows, or undef when exhausted.
each($callback)
Iterate over all remaining rows, calling callback for each row.
all
Collect all remaining rows into an array. Use with caution on large result sets.
close
Close the cursor and release server resources.
AUTHOR
John Napiorkowski <jjn1056@yahoo.com>