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   832 use strict;
  2         6  
  2         48  
4 2     2   28 use 5.008_005;
  2         7  
5              
6 2         101 use PawsX::DynamoDB::DocumentClient::Util qw(
7             make_arg_transformer
8             unmarshal_attribute_map
9 2     2   15 );
  2         4  
10 2     2   708 use PerlX::Maybe;
  2         2883  
  2         342  
11              
12 2     2 0 14 sub to_marshall { ['ExpressionAttributeValues', 'ExclusiveStartKey'] }
13              
14             sub transform_output {
15 4     4 0 21 my ($class, $output) = @_;
16             return {
17 4         135 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   162 my ($items) = @_;
25 4         49 return [ map { unmarshal_attribute_map($_) } @$items ];
  6         155  
26             }
27              
28             sub _unmarshall_key {
29 4     4   203 my ($key) = @_;
30 4 100 100     33 return undef unless $key && %{ $key->Map };
  3         66  
31 2         40 return unmarshal_attribute_map($key);
32             }
33              
34             1;
35             __END__