File Coverage

blib/lib/PawsX/DynamoDB/DocumentClient/QueryOrScan.pm
Criterion Covered Total %
statement 21 21 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 8 8 100.0
pod 0 2 0.0
total 34 36 94.4


line stmt bran cond sub pod time code
1             package PawsX::DynamoDB::DocumentClient::QueryOrScan;
2              
3 2     2   798 use strict;
  2         5  
  2         45  
4 2     2   27 use 5.008_005;
  2         7  
5              
6 2         116 use PawsX::DynamoDB::DocumentClient::Util qw(
7             make_arg_transformer
8             unmarshal_attribute_map
9 2     2   10 );
  2         6  
10 2     2   683 use PerlX::Maybe;
  2         3005  
  2         351  
11              
12 2     2 0 11 sub to_marshall { ['ExpressionAttributeValues', 'ExclusiveStartKey'] }
13              
14             sub transform_output {
15 4     4 0 14 my ($class, $output) = @_;
16             return {
17 4         104 count => $output->Count,
18             items => _unmarshall_items($output->Items),
19             maybe last_evaluated_key => _unmarshall_key($output->LastEvaluatedKey),
20             };
21             }
22              
23             sub _unmarshall_items {
24 4     4   153 my ($items) = @_;
25 4         35 return [ map { unmarshal_attribute_map($_) } @$items ];
  6         156  
26             }
27              
28             sub _unmarshall_key {
29 4     4   216 my ($key) = @_;
30 4 100 100     28 return undef unless $key && %{ $key->Map };
  3         65  
31 2         41 return unmarshal_attribute_map($key);
32             }
33              
34             1;
35             __END__