NAME

Mojo::PgX::Cursor::Results

SYNOPSIS

DESCRIPTION

Mojo::PgX::Cursor::Results is a container for Mojo::PgX::Cursor cursor like Mojo::Pg::Results is for statement handles.

ATTRIBUTES

cursor

my $cursor = $results->cursor;
$results = $results->cursor($cursor);

Mojo::PgX::Cursor::Cursor results are fetched from.

fetch

$results->fetch(100);

The quantity of rows to fetch in each batch of rows. Smaller uses less memory.

reload_at

$results->reload_at(50);

The threshold of remaining rows which will trigger a non-blocking reload to start. Smaller uses less memory.

seconds_blocked

my $time_wasted = $results->seconds_blocked;

The cumulative time the cursor has spent blocking upon running out of rows.

METHODS

array

my $row = $results->array;

Return next row from "cursor" as an array reference. If necessary, the next row will be fetched first.

columns

my $columns = $results->columns;

Return column names as an array reference.

expand

$results = $results->expand;

Decode json and jsonb fields automatically for all rows.

hash

my $row = $results->hash;

Return next row from "cursor" as a hash reference. If necessary, the next row will be fetched first.

new

my $results = Mojo::PgX::Cursor::Results->new(cursor => $cursor);

Construct a new Mojo::PgX::Cursor::Results object.

reload

$results->reload;
$results->reload(1000);

Manually trigger a new batch of rows to be fetched. The Mojo::PgX::Cursor::Results object uses the "fetch"" in " and "reload_at"" in " attributes to automatically reload. This method is just available in case you want to implement more advanced logic in your app. If passed an argument that value overrides "fetch"" in ".

rows

my $num = $results->rows;

Number of rows in current batch; not total.

LICENSE

Copyright (C) Nathaniel Nutter.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Nathaniel Nutter nnutter@cpan.org

SEE ALSO

Mojo::PgX::Cursor, Mojo::PgX::Cursor::Cursor