File Coverage

blib/lib/WebAPI/DBIC/Resource/Role/Identity.pm
Criterion Covered Total %
statement 6 17 35.2
branch n/a
condition n/a
subroutine 2 6 33.3
pod 0 4 0.0
total 8 27 29.6


line stmt bran cond sub pod time code
1             package WebAPI::DBIC::Resource::Role::Identity;
2             $WebAPI::DBIC::Resource::Role::Identity::VERSION = '0.004001';
3              
4 2     2   29561795 use Moo::Role;
  2         43277  
  2         18  
5              
6 2     2   720 use Carp;
  2         13  
  2         537  
7              
8              
9             sub id_unique_constraint_name { # called as static method
10 0     0 0   return 'primary',
11             }
12              
13             sub id_column_names_for_item { # local
14 0     0 0   my ($self, $item) = @_;
15 0           return $item->result_source->unique_constraint_columns( $self->id_unique_constraint_name );
16             }
17              
18             sub id_column_values_for_item { # used by ::Relationship
19 0     0 0   my ($self, $item) = @_;
20 0           return map { $item->get_column($_) } $self->id_column_names_for_item($item);
  0            
21             }
22              
23             sub id_kvs_for_item { # used by path_for_item
24 0     0 0   my ($self, $item) = @_;
25 0           my @key_fields = $self->id_column_names_for_item($item);
26 0           my $idn = 0;
27 0           return map { ++$idn => $item->get_column($_) } @key_fields;
  0            
28             }
29              
30              
31             1;
32              
33             __END__
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             WebAPI::DBIC::Resource::Role::Identity
42              
43             =head1 VERSION
44              
45             version 0.004001
46              
47             =head1 NAME
48              
49             WebAPI::DBIC::Resource::Role::Identity - methods related to the identity of resources
50              
51             =head1 AUTHOR
52              
53             Tim Bunce <Tim.Bunce@pobox.com>
54              
55             =head1 COPYRIGHT AND LICENSE
56              
57             This software is copyright (c) 2015 by Tim Bunce.
58              
59             This is free software; you can redistribute it and/or modify it under
60             the same terms as the Perl 5 programming language system itself.
61              
62             =cut