DBIx::Class::InflateColumn::ClassTypeEnum - Inflate enum-like columns to your Class::Type::Enum classes
version 0.007
package My::Schema::Result::Toast { __PACKAGE__->load_components(qw/ InflateColumn::ClassTypeEnum Core /); # Assuming Toast::Status is one of your enum classes... use Toast::Status; # Ensure it is loaded. __PACKAGE__->add_columns( status => { data_type => 'varchar', extra => { enum_class => 'Toast::Status', }, } ); }
Inflate DBIC columns into instances of your Class::Type::Enum classes. The storage data_type doesn't matter here, only whether or not enums should inflate/deflate to symbols (strings) or ordinals (integers).
data_type
This method chains with "register_column" in DBIx::Class::Row and checks for two subkeys inside the extra key of the column info:
extra
Required to enable column inflation. Specify the complete class name that this column should be inflated to. It should already be loaded and must be a subclass of Class::Type::Enum.
If true, the column is inflated from and deflated to ordinal values.
Class::Type::Enum
DBIx::Class::InflateColumn::Object::Enum
Meredith Howard <mhoward@cpan.org>
This software is copyright (c) 2017 by Meredith Howard.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Class::Type::Enum, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Type::Enum
CPAN shell
perl -MCPAN -e shell install Class::Type::Enum
For more information on module installation, please visit the detailed CPAN module installation guide.