File Coverage

blib/lib/DBIx/Class/Helper/ResultSet/NoColumns.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package DBIx::Class::Helper::ResultSet::NoColumns;
2             $DBIx::Class::Helper::ResultSet::NoColumns::VERSION = '2.034002';
3             # ABSTRACT: Look ma, no columns!
4              
5 55     55   22346 use strict;
  55         121  
  55         1309  
6 55     55   234 use warnings;
  55         89  
  55         1198  
7              
8 55     55   233 use parent 'DBIx::Class::ResultSet';
  55         87  
  55         226  
9              
10 1     1 1 360 sub no_columns { $_[0]->search(undef, { columns => [] }) }
11              
12             1;
13              
14             __END__
15              
16             =pod
17              
18             =head1 NAME
19              
20             DBIx::Class::Helper::ResultSet::NoColumns - Look ma, no columns!
21              
22             =head1 SYNOPSIS
23              
24             package MySchema::ResultSet::Bar;
25              
26             use strict;
27             use warnings;
28              
29             use parent 'DBIx::Class::ResultSet';
30              
31             __PACKAGE__->load_components('Helper::ResultSet::NoColumns');
32              
33             # in code using resultset:
34             my $rs = $schema->resultset('Bar')->no_columns->search(undef, {
35             '+columns' => { 'foo' => 'me.foo' },
36             });
37              
38             =head1 DESCRIPTION
39              
40             This component simply gives you a method to clear the set of columns to be
41             selected. It's just handy sugar.
42              
43             See L<DBIx::Class::Helper::ResultSet/NOTE> for a nice way to apply this to your
44             entire schema.
45              
46             =head1 METHODS
47              
48             =head2 no_columns
49              
50             $rs->no_columns
51              
52             Returns resultset with zero columns configured, fresh for the addition of new
53             columns.
54              
55             =head1 AUTHOR
56              
57             Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
58              
59             =head1 COPYRIGHT AND LICENSE
60              
61             This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
62              
63             This is free software; you can redistribute it and/or modify it under
64             the same terms as the Perl 5 programming language system itself.
65              
66             =cut