[Dbix-class] tinyint and enum mapping
jackal
me at jackal.in
Fri Nov 21 11:49:35 GMT 2008
On Thursday 20 November 2008 14:05:55 Peter Rabbitson wrote:
> jackal wrote:
> > I'll think about it. It may be better to create a new module, which adds
> > this functionality for (Inflate|Modify)Column...
>
> Please by all means share your design decisions with us before writing
> such a module. It would be a shame to not be able to merge this
> functionality into the upcoming .09 without breaking compatibility.
>
Maybe something like:
__PACKAGE__->magick_columns(\@cols, \@attrs?, {
inflate => sub {}, deflate => sub {}
});
Pseudo columns defined in @attrs will be created, so you can use it as
ordinary columns in ORM.
inflate/deflate can operate with any @cols and @attrs and modify them if
needed.
So it can be used in conjunction with InflateColumn and/or ModifyColumn.
For example, you can inflate timestamp column into DateTime by InflateColumn,
then (maybe) modify DateTime object by ModifyColumn and then set correct
timezone depending on user preferences (column 'tz' for example, possibly in
other table) and set independent 'date' and 'time' pseudo-columns.
All this can be done without InflateColumn and/or ModifyColumn, ofcourse.
It's just an idea...
--
Kind regards, Eugeny.
More information about the DBIx-Class
mailing list