add strictures to resultsets
This commit is contained in:
@@ -37,12 +37,14 @@ __PACKAGE__->set_primary_key("mac", "ip");
|
||||
# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9+CuvuVWH88WxAf6IBij8g
|
||||
|
||||
# some customize their node_ip table to have a dns column which
|
||||
# is the cached record at the time of discovery
|
||||
|
||||
# XXX uncomment the following two lines if you have a "dns" column XXX
|
||||
# XXX in your node_ip table which caches the host's name XXX
|
||||
__PACKAGE__->add_column("dns" =>
|
||||
{ data_type => "text", is_nullable => 1, accessor => undef });
|
||||
# XXX ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ XXX
|
||||
|
||||
# some customize their node_ip table to have a dns column which
|
||||
# is the cached record at the time of discovery
|
||||
sub dns {
|
||||
my $row = shift;
|
||||
return $row->get_column('dns')
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package Netdisco::DB::ResultSet::Device;
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use NetAddr::IP::Lite ':lower';
|
||||
|
||||
# override the built-in so we can munge some columns
|
||||
@@ -10,7 +12,7 @@ sub find {
|
||||
return $set->SUPER::find($ip,
|
||||
{
|
||||
'+select' => [
|
||||
\"replace(age(timestamp 'epoch' + uptime / 100 * interval '1 second', timestamp '1970-01-01 00:00:00-00')::text, 'mons', 'months')",
|
||||
\"replace(age(timestamp 'epoch' + uptime / 100 * interval '1 second', timestamp '1970-01-01 00:00:00-00')::text, 'mon', 'month')",
|
||||
\"to_char(last_discover, 'YYYY-MM-DD HH24:MI')",
|
||||
\"to_char(last_macsuck, 'YYYY-MM-DD HH24:MI')",
|
||||
\"to_char(last_arpnip, 'YYYY-MM-DD HH24:MI')",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package Netdisco::DB::ResultSet::DevicePort;
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
sub by_mac {
|
||||
my ($set, $mac) = @_;
|
||||
return $set unless $mac;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package Netdisco::DB::ResultSet::Node;
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
sub by_mac {
|
||||
my ($set, $archive, $mac) = @_;
|
||||
return $set unless $mac;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package Netdisco::DB::ResultSet::NodeIp;
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
# some customize their node_ip table to have a dns column which
|
||||
# is the cached record at the time of discovery
|
||||
sub has_dns_col {
|
||||
|
||||
Reference in New Issue
Block a user