| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | package KiokuDB::Backend::Role::Query::Simple::Linear; | ||
| 4 | 21 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 21 | ▶ | use namespace::clean -except => 'meta'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 21 | with qw(KiokuDB::Backend::Role::Query::Simple); | |
| 9 | |||
| 10 | 21 | requires "root_entries"; | |
| 11 | |||
| 12 | sub simple_search { | ||
| 13 | 59 | ▶ | my ( $self, $proto ) = @_; |
|
Subroutine
simple_search: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 14 | |||
| 15 | # FIXME $proto is sql::abstract 2? or...? | ||
| 16 | |||
| 17 | 59 | my $root_set = $self->root_entries; | |
| 18 | |||
| 19 | return $root_set->filter(sub { | ||
| 20 | return [ grep { | ||
| 21 | 51 | ▶ | my $entry = $_; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 22 | 153 | $self->compare_naive($entry->data, $proto); | |
| 23 | } @$_ ] | ||
| 24 | 51 | }); | |
| 25 | } | ||
| 26 | |||
| 27 | 21 | __PACKAGE__ | |
| 28 | |||
| 29 | __END__ | ||
| 30 | |||
| 31 | =pod | ||
| 32 | |||
| 33 | =head1 NAME | ||
| 34 | |||
| 35 | KiokuDB::Backend::Role::Query::Simple::Linear - Query::Simple implemented with | ||
| 36 | a linear scan of all entries. | ||
| 37 | |||
| 38 | =head1 SYNOPSIS | ||
| 39 | |||
| 40 | package MyBackend; | ||
| 41 | use Moose; | ||
| 42 | |||
| 43 | with qw( | ||
| 44 | KiokuDB::Backend::Role::Scan | ||
| 45 | KiokuDB::Backend::Role::Query::Simple::Linear | ||
| 46 | ); | ||
| 47 | |||
| 48 | =head1 DESCRIPTION | ||
| 49 | |||
| 50 | This role can provide a primitive C<search> facility (the API described in | ||
| 51 | L<KiokuDB::Backend::Role::Query::Simple>) using the api provided by | ||
| 52 | L<KiokuDB::Backend::Role::Scan>. While very inefficient for large data sets, of | ||
| 53 | your databases are small this can be useful. | ||
| 54 | |||