=encoding utf8

=head1 NAME

Couch::DB::Row - a single row of a page

=head1 SYNOPSIS

  my $list = $db->allDocs({include_docs => 1}, _all => 1);
  my @rows = $list->page;
  my @docs = map $_->doc, @rows;

  foreach my $row (@rows)
  {   printf "page %3d item %4d: %s\n",
         $row->pageNumber,
         $row->rowNumberInPage,
         $row->doc->{name};
  }

=head1 DESCRIPTION

Many command can page their answers.  The resulting rows are
each wrapped in this object for nicer abstraction of the data
structures.

=head1 METHODS

=head2 Constructors

=over 4

=item $class-E<gt>B<new>(%options)

Z<>

 -Option--Default
  answer  <required>
  doc     undef
  result  <required>
  rownr   <required>
  values  undef

=over 2

=item answer => JSON

The JSON structure from the result which represents this row.

=item doc => Couch::DB::Document-object

=item result => Couch::DB::Result

The result-object which contains this row.

=item rownr => INTEGER

The location of this row in the result.  Starts at 1.

=item values => HASH

The answer about this row converted to Perl data types.  Default to
the C<answer>.

=back

=back

=head2 Accessors

=over 4

=item $obj-E<gt>B<answer>()

The JSON fragment from the result answer which contains the information
about this row.

=item $obj-E<gt>B<doc>()

In case the response contains a document structure (you may need to
use C<include_docs> in the query), then this method will return a
C<Couch::DB::Document> object.

=item $obj-E<gt>B<result>()

The L<Couch::DB::Result|Couch::DB::Result> structure which contained this row.  Within one
page, this may be different for different rows.

=item $obj-E<gt>B<values>()

The answer about this row, translated into Perl data types.

=back

=head2 Paging

=over 4

=item $obj-E<gt>B<pageNumber>()

Z<>

=item $obj-E<gt>B<rowNumberInPage>()

Z<>

=item $obj-E<gt>B<rowNumberInResult>()

Z<>

=item $obj-E<gt>B<rowNumberInSearch>()

Z<>

=back

=head1 SEE ALSO

This module is part of Couch-DB version 0.201,
built on January 30, 2026. Website: F<http://perl.overmeer.net/CPAN/>

=head1 LICENSE

For contributors see file ChangeLog.

This software is copyright (c) 2024-2026 by Mark Overmeer.

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

