blib/lib/App/Netdisco/DB/Result/Virtual/NodeWithAge.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 23 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use utf8;
2 package App::Netdisco::DB::Result::Virtual::NodeWithAge;
3  
4 use strict;
5 use warnings;
6  
7 use base 'App::Netdisco::DB::Result::Node';
8  
9 __PACKAGE__->load_components('Helper::Row::SubClass');
10 __PACKAGE__->subclass;
11  
12 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
13 __PACKAGE__->table("node_with_age");
14 __PACKAGE__->result_source_instance->is_virtual(1);
15 __PACKAGE__->result_source_instance->view_definition(q{
16 SELECT *,
17 replace( date_trunc( 'minute', age( LOCALTIMESTAMP, time_last + interval '30 second' ) ) ::text, 'mon', 'month')
18 AS time_last_age
19 FROM node
20 });
21  
22 __PACKAGE__->add_columns(
23 "time_last_age",
24 { data_type => "text", is_nullable => 1 },
25 );
26  
27 1;