logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

DBIx::Class::InflateColumn::ClassTypeEnum - Inflate enum-like columns to your Class::Type::Enum classes

Author

       Meredith Howard <mhoward@cpan.org>

Description

       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).

Methods

register_column($column,$info)
       This method chains with "register_column" in DBIx::Class::Row and checks for two subkeys inside the
       "extra" key of the column info:

       enum_class
           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.

       enum_ordinal_storage
           If true, the column is inflated from and deflated to ordinal values.

Name

       DBIx::Class::InflateColumn::ClassTypeEnum - Inflate enum-like columns to your Class::Type::Enum classes

See Also

       •   Class::Type::Enum

       •   DBIx::Class::InflateColumn::Object::Enum

Synopsis

         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',
               },
             }
           );
         }

Version

       version 0.014

See Also