4 |
|
|
5 |
This is REST wrapper using following L<Mojo> implement Apache's CouchDB API |
This is REST wrapper using following L<Mojo> implement Apache's CouchDB API |
6 |
|
|
7 |
|
You can access it using normal C</_utils/> URI, just like on real CouchDB and |
8 |
|
it will bring up partially functional Futon interface against this module. |
9 |
|
|
10 |
L<Mojo::URL> |
L<Mojo::URL> |
11 |
|
|
200 |
my $by = $1; |
my $by = $1; |
201 |
my $offset = 0; |
my $offset = 0; |
202 |
my $startkey = delete $arg->{startkey}; |
my $startkey = delete $arg->{startkey}; |
203 |
|
$startkey ||= delete $arg->{startkey_docid}; # XXX key == id |
204 |
my $endkey = delete $arg->{endkey}; |
my $endkey = delete $arg->{endkey}; |
205 |
my $limit = delete $arg->{limit}; |
my $limit = delete $arg->{limit}; |
206 |
my $skip = delete $arg->{skip}; |
my $skip = delete $arg->{skip}; |
207 |
my $total_rows = 0; |
my $total_rows = 0; |
208 |
|
my $collected_rows = 0; |
209 |
|
|
210 |
my @docs = grep { length $_ } map { |
my @docs = grep { length $_ } map { |
211 |
|
|
212 |
if ( $limit > 0 && $total_rows == $limit ) { |
$total_rows++; |
213 |
|
|
214 |
|
if ( $limit > 0 && $collected_rows == $limit ) { |
215 |
''; |
''; |
216 |
} else { |
} else { |
217 |
|
|
221 |
''; |
''; |
222 |
} elsif ( $startkey ) { |
} elsif ( $startkey ) { |
223 |
if ( $_ ge $startkey ) { |
if ( $_ ge $startkey ) { |
224 |
$total_rows++; |
$collected_rows++; |
225 |
$_; |
$_; |
226 |
} else { |
} else { |
227 |
$offset++; |
$offset++; |
228 |
''; |
''; |
229 |
} |
} |
230 |
} else { |
} else { |
231 |
$total_rows++; |
$collected_rows++; |
232 |
$_; |
$_; |
233 |
} |
} |
234 |
} |
} |