1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
package Cassandra::Client::ResultSet;
our $AUTHORITY = 'cpan:TVDW';
$Cassandra::Client::ResultSet::VERSION = '0.21';
use 5.010;
use strict;
use warnings;
sub new {
my ($class, $raw_data, $decoder, $next_page)= @_;
return bless {
raw_data => $raw_data,
decoder => $decoder,
next_page => $next_page,
}, $class;
}
sub rows {
return $_[0]{rows} ||= $_[0]{decoder}->decode(${$_[0]{raw_data}}, 0);
}
sub row_hashes {
return $_[0]{row_hashes} ||= $_[0]{decoder}->decode(${$_[0]{raw_data}}, 1);
}
sub column_names {
$_[0]{decoder}->column_names
}
sub next_page {
$_[0]{next_page}
}
1;
__END__
=pod
=head1 NAME
Cassandra::Client::ResultSet
=head1 VERSION
version 0.21
=head1 METHODS
=over
=item $result->rows()
Returns an arrayref of all rows in the ResultSet. Each row will be represented as an arrayref with cells. To find column names, see C<column_names>.
=item $result->row_hashes()
Returns an arrayref of all rows in the ResultSet. Each row will be represented as a hashref with cells.
=item $result->column_names()
Returns an arrayref with the names of the columns in the result set, to be used with rows returned from C<rows()>.
=item $result->next_page()
Returns a string pointing to the next Cassandra result page, if any. Used internally by C<< $client->each_page() >>, but can be used to implement custom pagination logic.
=back
=head1 AUTHOR
Tom van der Woerdt <tvdw@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2023 by Tom van der Woerdt.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|