Branch Coverage

blib/lib/Perinci/Sub/Gen/AccessTable.pm
Criterion Covered Total %
branch 352 444 79.2


line true false branch
35 211 4 if ref $data eq "ARRAY"
40 133 4 if ref $data eq "ARRAY"
46 0 12 unless $args and $args->{$arg}
48 0 12 unless $tags
50 0 12 unless ref $tag eq "HASH"
51 12 0 if $tag->{'name'} =~ /^category:filtering/
64 0 1920 if $func_meta->{'args'}{$arg_name}
68 529 1391 ref $args{'type'} eq 'ARRAY' ? :
70 137 1783 if defined $args{'default'}
76 98 1822 if ($args{'aliases'})
80 32 1888 if (defined $args{'pos'})
84 32 1888 if (defined $args{'slurpy'})
88 98 1822 if ($args{'extra_props'})
100 1755 2085 unless defined $args{$prop}
103 2085 0 unless setlocale(6, $lang)
105 2085 0 $isdeflang ? :
112 1920 0 unless setlocale(6, $lang)
114 1920 0 $isdeflang ? :
197 33 1 if $opts->{'enable_field_selection'}
212 33 1 if $opts->{'enable_field_selection'}
231 33 1 if $opts->{'enable_ordering'}
242 32 1 if $opts->{'enable_ordering'} and $opts->{'enable_random_ordering'}
253 33 1 if $opts->{'enable_paging'}
264 33 1 if $opts->{'enable_paging'}
290 32 1 if $opts->{'enable_filtering'} and $opts->{'enable_search'}
308 32 1 if $opts->{'enable_filtering'} and $opts->{'enable_search'}
318 8 241 unless $opts->{'enable_filtering'}
319 29 212 if defined $fspec->{'filterable'} and not $fspec->{'filterable'}
321 1 211 unless ($fspec->{'include_by_default'} // 1)
344 212 0 unless ($func_args->{$fname})
363 153 59 unless ($ftype ~~ ["array", "bool"])
385 30 182 if ($ftype eq "array")
409 153 59 if ($ftype =~ /^(?:int|float|str|date)$/)
455 64 148 if ($ftype eq "str")
478 30 34 if ($fspec->{'filterable_regex'})
506 33 1 if ($opts->{'enable_filtering'})
509 0 2 if $func_args->{$cfn}
541 9 169 if ($args->{'detail'} or $args->{'exclude_fields'}) { }
6 163 elsif ($args->{'fields'}) { }
544 2 60 unless $fspecs->{$_}{'include_by_default'} // 1
546 2 7 if ($args->{'exclude_fields'})
549 10 6 if grep {$field eq $_;} @{$$args{"exclude_fields"};}
554 5 0 $args->{'detail'} ? :
565 1 224 unless $_ ~~ \@fields
583 2 168 if (defined $$args{"$f.is"}) { }
0 168 elsif (defined $$args{"$f.isnt"}) { }
6 324 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
593 8 162 if $exists and not $f ~~ \@filter_fields
600 2 170 if (defined $$args{"$f.has"})
604 2 170 if (defined $$args{"$f.lacks"})
608 4 168 if $exists and not $f ~~ \@filter_fields
615 3 1032 if (defined $$args{"$f.in"})
619 3 1032 if (defined $$args{"$f.not_in"})
630 2 1033 if (defined $$args{"$f.is"}) { }
3 2060 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
638 2 1033 if (defined $$args{"$f.isnt"}) { }
3 2060 elsif (defined $args->{$f} and __is_filter_arg($f, $func_meta)) { }
646 7 1028 if (defined $$args{"$f.min"})
650 4 1031 if (defined $$args{"$f.max"})
654 2 1033 if (defined $$args{"$f.xmin"})
658 2 1033 if (defined $$args{"$f.xmax"})
662 22 1013 if $exists and not $f ~~ \@filter_fields
669 1 520 if (defined $$args{"$f.contains"})
673 1 520 if (defined $$args{"$f.not_contains"})
677 1 520 if (defined $$args{"$f.matches"})
681 1 520 if (defined $$args{"$f.not_matches"})
685 4 517 if $exists and not $f ~~ \@filter_fields
692 2 4 unless defined $args->{$cfn}
695 4 0 unless $_ ~~ \@filter_fields
703 2 1375 unless not defined $fspecs->{$_}{'searchable'}
706 10 166 defined $q ? :
1 176 defined $qq && @$qq ? :
707 11 166 if (@qq)
718 11 166 @qq ? :
720 176 1 unless ($opts->{'custom_search'})
733 8 169 if (defined $args->{'sort'})
736 1 8 unless $f ~~ \@fields
741 1 0 unless not defined $fspec->{'sortable'} or $fspec->{'sortable'}
742 0 7 $ftype =~ /^(int|float)$/ ? :
744 2 5 $desc ? :
777 728 11387 if (ref $av->{'schema'} and ref $av->{'schema'}[1] and defined $av->{'schema'}[1]{'default'})
782 9 12106 if ($ak =~ /\A(exclude_fields|fields)\z/ and defined $args{$ak})
784 7 2 unless ref $args{$ak} eq "ARRAY"
789 177 2 unless $hooks->{$_}
792 1 1 if ref $hres
799 177 1 unless $hooks->{$_}
802 0 1 if ref $hres
804 3 175 unless $res->[0] == 200
813 174 1 unless $hooks->{$_}
816 0 1 if ref $hres
818 173 2 if (__is_aoa($table_data) or __is_aoh($table_data)) { }
2 0 elsif (ref $table_data eq 'CODE') { }
823 0 2 unless eval {
824 0 2 unless ref $res eq "HASH"
827 0 2 unless __is_aoa($data) or __is_aoh($data)
839 174 1 unless $hooks->{$_}
842 0 1 if ref $hres
854 7 168 if (grep {$_->[1] eq "date";} @{$$query{"filters"};})
859 175 0 if %Data::Sah::Util::Type::Date::
865 218 471 if (ref $r0 eq 'ARRAY') { }
471 0 elsif (ref $r0 eq 'HASH') { }
880 4 685 if $metadata->{'filtered'}
885 0 187 if $ftype eq "cistr"
886 28 159 if ($op eq 'truth') { }
8 151 elsif ($op eq '~~') { }
8 143 elsif ($op eq '!~~') { }
12 131 elsif ($op eq 'in') { }
12 119 elsif ($op eq 'not_in') { }
3 116 elsif ($op eq '==' and $stringy and $cic) { }
5 111 elsif ($op eq '==' and $stringy) { }
4 107 elsif ($op eq '==' and $ftype eq 'date') { }
10 97 elsif ($op eq '==') { }
0 97 elsif ($op eq '!=' and $stringy and $cic) { }
0 97 elsif ($op eq '!=' and $stringy) { }
8 89 elsif ($op eq '!=' and $ftype eq 'date') { }
0 89 elsif ($op eq '!=') { }
0 89 elsif ($op eq '>=' and $stringy and $cic) { }
4 85 elsif ($op eq '>=' and $stringy) { }
4 81 elsif ($op eq '>=' and $ftype eq 'date') { }
18 63 elsif ($op eq '>=') { }
0 63 elsif ($op eq '>' and $stringy and $cic) { }
4 59 elsif ($op eq '>' and $stringy) { }
4 55 elsif ($op eq '>' and $ftype eq 'date') { }
0 55 elsif ($op eq '>') { }
0 55 elsif ($op eq '<=' and $stringy and $cic) { }
4 51 elsif ($op eq '<=' and $stringy) { }
4 47 elsif ($op eq '<=' and $ftype eq 'date') { }
8 39 elsif ($op eq '<=') { }
4 35 elsif ($op eq '<' and $stringy) { }
0 35 elsif ($op eq '<' and $stringy) { }
4 31 elsif ($op eq '<' and $ftype eq 'date') { }
0 31 elsif ($op eq '<') { }
4 27 elsif ($op eq '=~') { }
4 23 elsif ($op eq '!~') { }
0 23 elsif ($op eq 'pos' and $cic) { }
4 19 elsif ($op eq 'pos') { }
0 19 elsif ($op eq '!pos' and $cic) { }
4 15 elsif ($op eq '!pos') { }
15 0 elsif ($op eq 'call') { }
887 14 14 if $r_h->{$f} xor $opn
889 0 8 if ($stringy and $cic) { }
892 0 0 unless lc $_ ~~ \@vals
896 5 5 unless $_ ~~ \@{$$r_h{$f};}
900 0 8 if ($stringy and $cic) { }
903 0 0 if lc $_ ~~ \@vals
907 5 5 if $_ ~~ \@{$$r_h{$f};}
911 0 12 if ($stringy and $cic) { }
913 0 0 unless lc $r_h->{$f} ~~ \@vals
915 5 7 unless $r_h->{$f} ~~ \@$opn
918 0 12 if ($stringy and $cic) { }
920 0 0 if $r_h->{$f} ~~ \@vals
922 6 6 if $r_h->{$f} ~~ \@$opn
925 1 2 unless lc $r_h->{$f} eq lc $opn
927 3 2 unless $r_h->{$f} eq $opn
931 0 4 unless $dopn and $d
932 3 1 unless $d->compare($dopn) == 0
934 6 4 unless $r_h->{$f} == $opn
937 0 0 unless lc $r_h->{$f} ne lc $opn
939 0 0 unless $r_h->{$f} ne $opn
943 4 4 unless $dopn and $d
944 1 3 unless $d->compare($dopn) != 0
946 0 0 unless $r_h->{$f} != $opn
949 0 0 unless lc $r_h->{$f} ge lc $opn
951 1 3 unless $r_h->{$f} ge $opn
955 0 4 unless $dopn and $d
956 2 2 unless $d->compare($dopn) >= 0
958 7 11 unless $r_h->{$f} >= $opn
961 0 0 unless lc $r_h->{$f} gt lc $opn
963 2 2 unless $r_h->{$f} gt $opn
967 0 4 unless $dopn and $d
968 3 1 unless $d->compare($dopn) > 0
970 0 0 unless $r_h->{$f} > $opn
973 0 0 unless lc $r_h->{$f} le lc $opn
975 2 2 unless $r_h->{$f} le $opn
979 0 4 unless $dopn and $d
980 1 3 unless $d->compare($dopn) <= 0
982 3 5 unless $r_h->{$f} <= $opn
985 3 1 unless lc $r_h->{$f} lt lc $opn
987 0 0 unless $r_h->{$f} lt $opn
991 0 4 unless $dopn and $d
992 2 2 unless $d->compare($dopn) < 0
994 0 0 unless $r_h->{$f} < $opn
998 1 3 unless $r_h->{$f} =~ /$opn/
1002 3 1 if $r_h->{$f} =~ /$opn/
1005 0 0 unless index(lc $r_h->{$f}, lc $opn) >= 0
1007 1 3 unless index($r_h->{$f}, $opn) >= 0
1010 0 0 if index(lc $r_h->{$f}, lc $opn) >= 0
1012 3 1 if index($r_h->{$f}, $opn) >= 0
1015 6 9 unless $opn->[0]->($r_h, $opn->[1])
1022 40 552 if (defined $qq)
1023 4 36 if ($opts->{'custom_search'}) { }
1025 2 2 unless $opts->{'custom_search'}->($r_h, $qq, $query->{'search_opts'})
1029 6 66 if ($r_h->{$f} =~ /$search_re/is)
1036 3 27 if ($el =~ /$search_re/is)
1041 27 9 unless $match
1051 0 175 if ($metadata->{'sorted'}) { }
100 75 elsif ($query->{'random'}) { }
6 69 elsif (@{$query->{'sorts'};}) { }
1060 31 0 if ($op eq 'cmp') { }
1066 29 2 if $x != 0
1078 175 0 unless ($metadata->{'paged'})
1079 1 174 if ($query->{'result_start'} > 1)
1082 4 171 if (defined $query->{'result_limit'})
1090 0 175 if $metadata->{'fields_selected'}
1093 510 4 unless ($args{'detail'} or $args{'fields'} or $args{'exclude_fields'})
1097 36 14 if ($args{'with_field_names'}) { }
1101 92 196 unless $_ ~~ \@{$$query{"requested_fields"};}
1116 174 1 unless $hooks->{$_}
1119 0 1 if ref $hres
1533 0 38 unless $fqname
1535 0 38 if ($fqname =~ /(.+)::(.+)/) { }
1544 0 38 unless my $table_data = $args{'table_data'}
1545 0 16 unless __is_aoa($table_data) or __is_aoh($table_data) or ref $table_data eq "CODE"
1549 0 38 unless my $table_spec = $args{'table_spec'}
1550 0 38 unless ref $table_spec eq "HASH"
1553 1 37 unless $table_spec->{'fields'}
1554 0 37 unless ref $table_spec->{'fields'} eq "HASH"
1557 2 35 unless $table_spec->{'pk'}
1558 1 34 unless exists $table_spec->{'fields'}{$table_spec->{'pk'}}
1627 0 34 unless $res->[0] == 200
1631 0 34 unless $res->[0] == 200
1634 0 34 if ($args{'install'} // 1)