X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FDateTime%2FEpoch.pm;h=43c8755ff8cf0ff070f8c3efed0116e0a7ff1f85;hb=7f67d2d59b700c1b8d6c3bd6a2eecbb05a4a29f5;hp=b12a0ac6d4540dfa5816a2355ccf79d753f98748;hpb=457514782ff1cfcc0bb4f40f313cf22d896bb0a8;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..43c8755 100644 --- a/lib/DBIx/Class/DateTime/Epoch.pm +++ b/lib/DBIx/Class/DateTime/Epoch.pm @@ -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. @@ -99,7 +101,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';