1DBIx::Class::Helper::ReUssuelrtDSCBeoItnx:t::r:AiCubltuaotsResed:m:oPHveeerlClpoelDruo:mc:nuRsme(es3nu)tlattSieotn::AutoRemoveColumns(3)
2
3
4
6 DBIx::Class::Helper::ResultSet::AutoRemoveColumns - Automatically
7 remove columns from a ResultSet
8
10 package MySchema::Result::Bar;
11
12 use strict;
13 use warnings;
14
15 use parent 'DBIx::Class::Core';
16
17 __PACKAGE__->table('KittenRobot');
18 __PACKAGE__->add_columns(
19 id => {
20 data_type => 'integer',
21 is_auto_increment => 1,
22 },
23 kitten => {
24 data_type => 'integer',
25 },
26 robot => {
27 data_type => 'text',
28 is_nullable => 1,
29 },
30 your_mom => {
31 data_type => 'blob',
32 is_nullable => 1,
33 remove_column => 0,
34 },
35 );
36
37 1;
38
39 package MySchema::ResultSet::Bar;
40
41 use strict;
42 use warnings;
43
44 use parent 'DBIx::Class::ResultSet';
45
46 __PACKAGE__->load_components('Helper::ResultSet::AutoRemoveColumns');
47
49 This component automatically removes "heavy-weight" columns. To be
50 specific, columns of type "text", "ntext", "blob", "clob", or "bytea".
51 You may use the "remove_column" key in the column info to specify
52 directly whether or not to remove the column automatically. See "NOTE"
53 in DBIx::Class::Helper::ResultSet for a nice way to apply it to your
54 entire schema.
55
57 _should_column_fetch
58 $self->_should_column_fetch('kitten')
59
60 returns true if a column should be fetched or not. This fetches a
61 column if it is not of type "text", "ntext", "blob", "clob", or "bytea"
62 or the "remove_column" is set to true. If you only wanted to
63 explicitly state which columns to remove you might override this method
64 like this:
65
66 sub _should_column_fetch {
67 my ( $self, $column ) = @_;
68
69 my $info = $self->column_info($column);
70
71 return !defined $info->{remove_column} || $info->{remove_column};
72 }
73
74 fetchable_columns
75 simply returns a list of columns that are fetchable.
76
78 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
79
81 This software is copyright (c) 2020 by Arthur Axel "fREW" Schmidt.
82
83 This is free software; you can redistribute it and/or modify it under
84 the same terms as the Perl 5 programming language system itself.
85
86
87
88perl v5.38.0 DBIx::Cl2a0s2s3:-:0H7e-l2p0er::ResultSet::AutoRemoveColumns(3)