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   1048 use strict;
  2         5  
  2         55  
4 2     2   35 use 5.008_005;
  2         8  
5              
6 2         117 use PawsX::DynamoDB::DocumentClient::Util qw(
7             make_arg_transformer
8             unmarshal_attribute_map
9 2     2   15 );
  2         6  
10 2     2   941 use PerlX::Maybe;
  2         3591  
  2         436  
11              
12 2     2 0 14 sub to_marshall { ['ExpressionAttributeValues', 'ExclusiveStartKey'] }
13              
14             sub transform_output {
15 4     4 0 12 my ($class, $output) = @_;
16             return {
17 4         108 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   135 my ($items) = @_;
25 4         35 return [ map { unmarshal_attribute_map($_) } @$items ];
  6         130  
26             }
27              
28             sub _unmarshall_key {
29 4     4   189 my ($key) = @_;
30 4 100 100     27 return undef unless $key && %{ $key->Map };
  3         60  
31 2         33 return unmarshal_attribute_map($key);
32             }
33              
34             1;
35             __END__