1package App::Netdisco::DB::ResultSet::DevicePortSsid;
2use base 'App::Netdisco::DB::ResultSet';
3
4use strict;
5use warnings;
6
7__PACKAGE__->load_components(
8    qw/
9        +App::Netdisco::DB::ExplicitLocking
10        /
11);
12
13=head1 ADDITIONAL METHODS
14
15=head2 get_ssids
16
17Returns a sorted list of SSIDs with the following columns only:
18
19=over 4
20
21=item ssid
22
23=item broadcast
24
25=item count
26
27=back
28
29Where C<count> is the number of instances of the SSID in the Netdisco
30database.
31
32=cut
33
34sub get_ssids {
35    my $rs = shift;
36
37    return $rs->search(
38        {},
39        {   select => [ 'ssid', 'broadcast', { count => 'ssid' } ],
40            as       => [qw/ ssid broadcast count /],
41            group_by => [qw/ ssid broadcast /],
42            order_by => { -desc => [qw/count/] },
43        }
44        )
45
46}
47
481;
49