File Coverage

blib/lib/Perl5/CoreSmokeDB/Schema/Result/Config.pm
Criterion Covered Total %
statement 12 28 42.8
branch 0 4 0.0
condition n/a
subroutine 4 9 44.4
pod 1 5 20.0
total 17 46 36.9


line stmt bran cond sub pod time code
1 3     3   1425 use utf8;
  3         6  
  3         17  
2              
3             # Created by DBIx::Class::Schema::Loader
4             # DO NOT MODIFY THE FIRST PART OF THIS FILE
5              
6             =head1 NAME
7              
8             Perl5::CoreSmokeDB::Schema::Result::Config
9              
10             =cut
11              
12             use strict;
13 3     3   110 use warnings;
  3         6  
  3         57  
14 3     3   10  
  3         6  
  3         79  
15             use base 'DBIx::Class::Core';
16 3     3   15  
  3         5  
  3         1436  
17             =head1 COMPONENTS LOADED
18              
19             =over 4
20              
21             =item * L<DBIx::Class::InflateColumn::DateTime>
22              
23             =back
24              
25             =cut
26              
27             __PACKAGE__->load_components("InflateColumn::DateTime");
28              
29             =head1 TABLE: C<config>
30              
31             =cut
32              
33             __PACKAGE__->table("config");
34              
35             =head1 ACCESSORS
36              
37             =head2 id
38              
39             data_type: 'integer'
40             is_auto_increment: 1
41             is_nullable: 0
42             sequence: 'config_id_seq'
43              
44             =head2 report_id
45              
46             data_type: 'integer'
47             is_foreign_key: 1
48             is_nullable: 0
49              
50             =head2 arguments
51              
52             data_type: 'text'
53             is_nullable: 0
54             original: {data_type => "varchar"}
55              
56             =head2 debugging
57              
58             data_type: 'text'
59             is_nullable: 0
60             original: {data_type => "varchar"}
61              
62             =head2 started
63              
64             data_type: 'timestamp with time zone'
65             is_nullable: 1
66              
67             =head2 duration
68              
69             data_type: 'integer'
70             is_nullable: 1
71              
72             =head2 cc
73              
74             data_type: 'text'
75             is_nullable: 1
76             original: {data_type => "varchar"}
77              
78             =head2 ccversion
79              
80             data_type: 'text'
81             is_nullable: 1
82             original: {data_type => "varchar"}
83              
84             =cut
85              
86             __PACKAGE__->add_columns(
87             "id",
88             {
89             data_type => "integer",
90             is_auto_increment => 1,
91             is_nullable => 0,
92             sequence => "config_id_seq",
93             },
94             "report_id",
95             { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
96             "arguments",
97             {
98             data_type => "text",
99             is_nullable => 0,
100             original => { data_type => "varchar" },
101             },
102             "debugging",
103             {
104             data_type => "text",
105             is_nullable => 0,
106             original => { data_type => "varchar" },
107             },
108             "started",
109             { data_type => "timestamp with time zone", is_nullable => 1 },
110             "duration",
111             { data_type => "integer", is_nullable => 1 },
112             "cc",
113             {
114             data_type => "text",
115             is_nullable => 1,
116             original => { data_type => "varchar" },
117             },
118             "ccversion",
119             {
120             data_type => "text",
121             is_nullable => 1,
122             original => { data_type => "varchar" },
123             },
124             );
125              
126             =head1 PRIMARY KEY
127              
128             =over 4
129              
130             =item * L</id>
131              
132             =back
133              
134             =cut
135              
136             __PACKAGE__->set_primary_key("id");
137              
138             =head1 RELATIONS
139              
140             =head2 report
141              
142             Type: belongs_to
143              
144             Related object: L<Perl5::CoreSmokeDB::Schema::Result::Report>
145              
146             =cut
147              
148             __PACKAGE__->belongs_to(
149             "report",
150             "Perl5::CoreSmokeDB::Schema::Result::Report",
151             { id => "report_id" },
152             { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" },
153             );
154              
155             =head2 results
156              
157             Type: has_many
158              
159             Related object: L<Perl5::CoreSmokeDB::Schema::Result::Result>
160              
161             =cut
162              
163             __PACKAGE__->has_many(
164             "results",
165             "Perl5::CoreSmokeDB::Schema::Result::Result",
166             { "foreign.config_id" => "self.id" },
167             { cascade_copy => 0, cascade_delete => 0 },
168             );
169              
170              
171             # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-06 09:15:22
172             # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:l/lxpTgyv35unrcVapM8JQ
173              
174             my $self = shift;
175             return join("##", $self->cc, $self->ccversion);
176 0     0 0   }
177 0            
178             my $self = shift;
179             return join(" - ", $self->cc, $self->ccversion);
180             }
181 0     0 0    
182 0           my $self = shift;
183             return {value => $self->c_compiler_key, label => $self->c_compiler_label};
184             }
185              
186 0     0 0   my $self = shift;
187 0           return $self->debugging eq 'D'
188             ? join(" ", $self->arguments, 'DEBUGGING')
189             : $self->arguments;
190             }
191 0     0 0    
192 0 0         =head2 $record->as_hashref([$is_full])
193              
194             Returns a HashRef with the inflated columns.
195              
196             =head3 Parameters
197              
198             Positional:
199              
200             =over
201              
202             =item 1. C<'full'>
203              
204             If the word C<full> is passed as the first argument the related
205             C<results> are also included in the resulting HashRef.
206              
207             =back
208              
209             =cut
210              
211             my $self = shift;
212             my ($is_full) = @_;
213              
214             my $record = { $self->get_inflated_columns };
215             $record->{started} = $self->started->rfc3339;
216              
217 0     0 1   if ($is_full eq 'full') {
218 0           $record->{results} = [ map { $_->as_hashref($is_full) } $self->results ];
219             }
220 0            
221 0           return $record;
222             }
223 0 0          
224 0           1;
  0