« blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/App/DB/Schema.pm
↑ Summary
blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/App/Model/SQLBuilder.pm »
| 1 | package App::DB::Schema::Declare; | ||
| 2 | use Dwarf::Pragma; | ||
| 3 | use Teng::Schema::Declare; | ||
| 4 | use DateTime::Format::Pg; | ||
| 5 | |||
| 6 | use Exporter::Lite; | ||
| 7 | our @EXPORT = qw(datetime_columns); | ||
| 8 | |||
| 9 | sub datetime_columns { | ||
| 10 | my $columns_regexp = join('|', @_); | ||
| 11 | my $regexp = qr{^(?:$columns_regexp)$}; | ||
| 12 | my ($pkg) = caller; | ||
| 13 | my $inflate = \&{$pkg . '::inflate'}; | ||
| 14 | my $deflate = \&{$pkg . '::deflate'}; | ||
| 15 | $inflate->($regexp => sub { DateTime::Format::Pg->parse_datetime(@_) }); | ||
| 16 | $deflate->($regexp => sub { DateTime::Format::Pg->format_datetime(@_) }); | ||
| 17 | } | ||
| 18 | |||
| 19 | 1; |