Convert a DBIx::Class::Result into a hash

。_饼干妹妹 提交于 2019-12-01 23:19:49

I assume you're talking about DBIx::Class?

my $record = $schema->resultset("food")->create({name=>"bacon"});
my %record_columns = $record->get_columns;

# or, to get a HashRef directly
my $cols = { $record->get_columns };

# or, as you've asked for
my $foo = { record => { $record->get_columns } };

What you're looking for is included in DBIx::Class as DBIx::Class::ResultClass::HashRefInflator.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!