KiokuDB/GIN.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 93.5% 29 / 31 CC 4 SCAR 7.8
CC
4
Cov
93%
__ANON__
3.1
__ANON__
2.0
BEGIN
1.0
CRAP 2.2
« KiokuDB/TypeMap/Shadow.pm ↑ Summary KiokuDB/Test/Fixture/ObjectGraph.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::GIN;
4 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 with qw(
9 KiokuDB::Backend::Role::Query::GIN
10 Search::GIN::Driver
11 );
12  
13 1 has root_only => (
14 isa => "Bool",
15 is => "ro",
16 default => 1,
17 );
18  
19 after insert => sub {
20 49 ▶ my ( $self, @entries ) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.2
21  
22 49 ▶ @entries = grep { $_->root } @entries if $self->root_only;
Branch: 1 branch
BranchTrueFalseTotal
if $self->root_only 0 49 49
23  
24 49 my @idx_entries = grep { $_->has_object } @entries;
25  
26 49 foreach my $entry ( @idx_entries ) {
27 102 my @keys = $self->extract_values( $entry->object );
28 102 $self->insert_entry( $entry->id, @keys );
29 }
30 1 };
31  
32 after delete => sub {
33 5 ▶ my ( $self, @ids_or_entries ) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
34  
35 5 ▶ my @ids = map { ref($_) ? $_->id : $_ } @ids_or_entries;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 2 3 5
36  
37 5 $self->remove_ids(@ids);
38 1 };
39  
40 1 __PACKAGE__
41  
42 __END__
43  
44 =pod
45  
46 =head1 NAME
47  
48 KiokuDB::GIN - Gin assisted recollection
49  
50 =head1 SYNOPSIS
51  
52 use KiokuDB::GIN;
53  
54 =head1 DESCRIPTION
55  
56 This is a generic backend wrapping role that allows adding L<Search::GIN>
57 queries to any backend.
58  
59 =cut
60  
61  
« KiokuDB/TypeMap/Shadow.pm ↑ Summary KiokuDB/Test/Fixture/ObjectGraph.pm »