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

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 21 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::CidrIps;
2  
3 use strict;
4 use warnings;
5  
6 use utf8;
7 use base 'DBIx::Class::Core';
8  
9 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
10  
11 __PACKAGE__->table('cidr_ips');
12 __PACKAGE__->result_source_instance->is_virtual(1);
13 __PACKAGE__->result_source_instance->view_definition(<<'ENDSQL');
14 SELECT host(network (prefix) + sub.int)::inet AS ip,
15 NULL::macaddr AS mac,
16 NULL::timestamp AS time_first,
17 NULL::timestamp AS time_last,
18 NULL::text AS dns,
19 false::boolean AS active,
20 false::boolean AS node,
21 replace( date_trunc( 'minute', age( LOCALTIMESTAMP, NULL::timestamp ) ) ::text, 'mon', 'month') AS age,
22 NULL::text AS vendor,
23 NULL::text AS nbname
24 FROM (
25 SELECT prefix,
26 generate_series(1, (broadcast(prefix) - network(prefix) - 1)) AS int
27 FROM (
28 SELECT ?::inet AS prefix
29 ) AS addr
30 ) AS sub
31 ENDSQL
32  
33 __PACKAGE__->add_columns(
34 "ip",
35 { data_type => "inet", is_nullable => 0 },
36 "mac",
37 { data_type => "macaddr", is_nullable => 1 },
38 "time_first",
39 {
40 data_type => "timestamp",
41 is_nullable => 1,
42 },
43 "time_last",
44 {
45 data_type => "timestamp",
46 is_nullable => 1,
47 },
48 "dns",
49 { data_type => "text", is_nullable => 1 },
50 "active",
51 { data_type => "boolean", is_nullable => 1 },
52 "node",
53 { data_type => "boolean", is_nullable => 1 },
54 "age",
55 { data_type => "text", is_nullable => 1 },
56 "vendor",
57 { data_type => "text", is_nullable => 1 },
58 "nbname",
59 { data_type => "text", is_nullable => 1 },
60 );
61  
62 1;