X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDateTime%2FEpoch.pm;h=e18e3d42e9e0c77e8b5e139f905985344bac803d;hb=c553ccdbff3df482c192ffcb668fbb9161ebc7d1;hp=b12a0ac6d4540dfa5816a2355ccf79d753f98748;hpb=ab93b294c69521c488219fb35321183d8bde97d1;p=dbsrgits%2FDBIx-Class-DateTime-Epoch.git diff --git a/lib/DBIx/Class/DateTime/Epoch.pm b/lib/DBIx/Class/DateTime/Epoch.pm index b12a0ac..e18e3d4 100644 --- a/lib/DBIx/Class/DateTime/Epoch.pm +++ b/lib/DBIx/Class/DateTime/Epoch.pm @@ -3,7 +3,7 @@ package DBIx::Class::DateTime::Epoch; use strict; use warnings; -our $VERSION = '0.01'; +our $VERSION = '0.02'; use base qw( DBIx::Class ); @@ -27,15 +27,15 @@ DBIx::Class::DateTime::Epoch - Automatic inflation/deflation of epoch-based Date }, bar => { data_type => 'bigint', - datetime => 'datetime' + epoch => 1 }, creation_time => { data_type => 'bigint', - datetime => 'ctime' + epoch => 'ctime' }, modification_time => { data_type => 'bigint', - datetime => 'mtime' + epoch => 'mtime' } ); @@ -47,11 +47,13 @@ defined to specify their nature, such as columns representing a creation time (set at time of insertion) or a modification time (set at time of every update). +=head1 METHODS + =head2 register_column This method will automatically add inflation and deflation rules -to a column if a datetime value has been set in the column's definition. -If the datetime value is 'ctime' (creation time) or 'mtime' +to a column if an epoch value has been set in the column's definition. +If the epoch value is 'ctime' (creation time) or 'mtime' (modification time), it will be registered as such for later use by the insert and the update methods. @@ -79,8 +81,12 @@ even if it has been already set. =head1 AUTHOR +=over 4 + =item * Brian Cassidy Ebricas@cpan.orgE +=item * Adam Paynter Eadapay@cpan.orgE + =back =head1 COPYRIGHT AND LICENSE @@ -99,7 +105,7 @@ sub register_column { my( $class, $col, $info ) = @_; $class->next::method( $col, $info ); - if( my $type = $info->{ datetime } ) { + if( my $type = $info->{ epoch } ) { $class->ctime_columns( [ @{ $class->ctime_columns }, $col ] ) if $type eq 'ctime'; $class->mtime_columns( [ @{ $class->mtime_columns }, $col ] ) if $type eq 'mtime';