line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Helper::ResultSet::RemoveColumns; |
2
|
|
|
|
|
|
|
$DBIx::Class::Helper::ResultSet::RemoveColumns::VERSION = '2.034002'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Remove columns from a ResultSet |
4
|
|
|
|
|
|
|
|
5
|
55
|
|
|
55
|
|
21054
|
use strict; |
|
55
|
|
|
|
|
128
|
|
|
55
|
|
|
|
|
1281
|
|
6
|
55
|
|
|
55
|
|
241
|
use warnings; |
|
55
|
|
|
|
|
136
|
|
|
55
|
|
|
|
|
1177
|
|
7
|
|
|
|
|
|
|
|
8
|
55
|
|
|
55
|
|
234
|
use parent 'DBIx::Class::ResultSet'; |
|
55
|
|
|
|
|
110
|
|
|
55
|
|
|
|
|
249
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _resolved_attrs { |
11
|
495
|
|
|
495
|
|
160957
|
my $self = $_[0]; |
12
|
|
|
|
|
|
|
|
13
|
495
|
|
|
|
|
926
|
my $attrs = $self->{attrs}; # not copying on purpose... |
14
|
|
|
|
|
|
|
|
15
|
495
|
100
|
100
|
|
|
2739
|
if ( !$attrs->{columns} && !$attrs->{select} && $attrs->{remove_columns} ) { |
|
|
|
100
|
|
|
|
|
16
|
52
|
|
|
|
|
132
|
my %rc = map { $_ => 1 } @{$attrs->{remove_columns}}; |
|
154
|
|
|
|
|
395
|
|
|
52
|
|
|
|
|
166
|
|
17
|
|
|
|
|
|
|
$attrs->{columns} = [ |
18
|
52
|
|
|
|
|
285
|
grep { !$rc{$_} } $self->result_source->columns |
|
206
|
|
|
|
|
780
|
|
19
|
|
|
|
|
|
|
] |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
495
|
|
|
|
|
1331
|
return $self->next::method; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
DBIx::Class::Helper::ResultSet::RemoveColumns - Remove columns from a ResultSet |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
package MySchema::ResultSet::Bar; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use strict; |
40
|
|
|
|
|
|
|
use warnings; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use parent 'DBIx::Class::ResultSet'; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__PACKAGE__->load_components('Helper::ResultSet::RemoveColumns'); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# in code using resultset: |
47
|
|
|
|
|
|
|
my $rs = $schema->resultset('Bar')->search(undef, { |
48
|
|
|
|
|
|
|
remove_columns => ['giant_text_col', 'password'], |
49
|
|
|
|
|
|
|
}); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This component allows convenient removal of columns from a select. |
54
|
|
|
|
|
|
|
Normally to do this you would do this by listing all of the columns |
55
|
|
|
|
|
|
|
B<except> the ones you want to remove. This does that part for you. |
56
|
|
|
|
|
|
|
See L<DBIx::Class::Helper::ResultSet/NOTE> for a nice way to apply it to |
57
|
|
|
|
|
|
|
your entire schema. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
It doesn't get a lot more complicated than the synopsis. If you are interested |
60
|
|
|
|
|
|
|
in having more control, check out |
61
|
|
|
|
|
|
|
L<DBIx::Class::Helper::ResultSet::AutoRemoveColumns>. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=over |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item * |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Load the component |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Put an C<ArrayRef> of columns to remove in the C<remove_columns> search attribute. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Profit. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
88
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |