« blib/lib/App/Netdisco/DB/ResultSet/DeviceBrowser.pm
↑ Summary
blib/lib/App/Netdisco/DB/ResultSet/DevicePortSsid.pm »
| 1 | package App::Netdisco::DB::ResultSet::DevicePortLog; | ||
| 2 | use base 'App::Netdisco::DB::ResultSet'; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | __PACKAGE__->load_components(qw/ | ||
| 8 | +App::Netdisco::DB::ExplicitLocking | ||
| 9 | /); | ||
| 10 | |||
| 11 | =head1 ADDITIONAL METHODS | ||
| 12 | |||
| 13 | =head2 with_times | ||
| 14 | |||
| 15 | This is a modifier for any C<search()> which will add the following additional | ||
| 16 | synthesized column to the result set: | ||
| 17 | |||
| 18 | =over 4 | ||
| 19 | |||
| 20 | =item creation_stamp | ||
| 21 | |||
| 22 | =back | ||
| 23 | |||
| 24 | =cut | ||
| 25 | |||
| 26 | sub with_times { | ||
| 27 | my ($rs, $cond, $attrs) = @_; | ||
| 28 | |||
| 29 | return $rs | ||
| 30 | ->search_rs($cond, $attrs) | ||
| 31 | ->search({}, | ||
| 32 | { | ||
| 33 | '+columns' => { | ||
| 34 | creation_stamp => \"to_char(creation, 'YYYY-MM-DD HH24:MI:SS')", | ||
| 35 | }, | ||
| 36 | }); | ||
| 37 | } | ||
| 38 | |||
| 39 | 1; |