File Coverage

blib/lib/Daje/Workflow/FileChanged/Database/Model/FileHashes.pm
Criterion Covered Total %
statement 3 17 17.6
branch 0 2 0.0
condition 0 3 0.0
subroutine 1 3 33.3
pod 2 2 100.0
total 6 27 22.2


line stmt bran cond sub pod time code
1             package Daje::Workflow::FileChanged::Database::Model::FileHashes;
2 1     1   7 use Mojo::Base -base, -signatures;
  1         2  
  1         11  
3              
4              
5             has 'db';
6              
7              
8 0     0 1   sub save_hash($self, $file, $hash) {
  0            
  0            
  0            
  0            
9              
10 0           $self->db->insert(
11             'file_hashes',
12             {
13             file => $file, hash => $hash, moddatetime => 'NOW()'
14             },
15             {
16             on_conflict => [
17             file => {
18             hash => $hash
19             }
20             ]
21             }
22             );
23             }
24              
25 0     0 1   sub load_hash($self, $file_path_name) {
  0            
  0            
  0            
26              
27 0           my $hash;
28 0           my $data = $self->db->select(
29             'file_hashes',
30             ['*'],
31             {
32             file => $file_path_name
33             }
34             );
35              
36 0 0 0       $hash = $data->hash if defined $data and $data->rows > 0;
37              
38 0           return $hash;
39             }
40             1;
41             #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
42              
43             =head1 NAME
44              
45             Daje::Workflow::FileChanged::Database::Model::FileHashes
46              
47              
48             =head1 REQUIRES
49              
50             L
51              
52              
53             =head1 METHODS
54              
55             =head2 load_hash($self,
56              
57             load_hash($self,();
58              
59             =head2 save_hash($self,
60              
61             save_hash($self,();
62              
63              
64             =cut
65