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

filter: Statementstmt 0.0% 0 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 17 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package App::Netdisco::DB::Result::Virtual::LastNode;
2  
3 use strict;
4 use warnings;
5  
6 use base 'App::Netdisco::DB::Result';
7  
8 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
9  
10 __PACKAGE__->table('last_node');
11 __PACKAGE__->result_source_instance->is_virtual(1);
12 __PACKAGE__->result_source_instance->view_definition(<<ENDSQL
13 SELECT DISTINCT ON (switch, port) * FROM node
14 ORDER BY switch, port, time_last desc
15 ENDSQL
16 );
17  
18 __PACKAGE__->add_columns(
19 "mac",
20 { data_type => "macaddr", is_nullable => 0 },
21 "switch",
22 { data_type => "inet", is_nullable => 0 },
23 "port",
24 { data_type => "text", is_nullable => 0 },
25 "active",
26 { data_type => "boolean", is_nullable => 1 },
27 "oui",
28 { data_type => "varchar", is_nullable => 1, size => 9 },
29 "time_first",
30 {
31 data_type => "timestamp",
32 default_value => \"LOCALTIMESTAMP",
33 is_nullable => 1,
34 original => { default_value => \"LOCALTIMESTAMP" },
35 },
36 "time_recent",
37 {
38 data_type => "timestamp",
39 default_value => \"LOCALTIMESTAMP",
40 is_nullable => 1,
41 original => { default_value => \"LOCALTIMESTAMP" },
42 },
43 "time_last",
44 {
45 data_type => "timestamp",
46 default_value => \"LOCALTIMESTAMP",
47 is_nullable => 1,
48 original => { default_value => \"LOCALTIMESTAMP" },
49 },
50 "vlan",
51 { data_type => "text", is_nullable => 0, default_value => '0' },
52 );
53  
54 1;