-
-
22 Oct 2012 18:10:15 UTC
- Distribution: DBIx-Class-DateTime-Epoch
- Module version: 0.10
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (2)
- Testers (1954 / 3 / 0)
- Kwalitee
Bus factor: 1- 91.94% Coverage
- License: perl_5
- Perl: v5.6.1
- Activity
24 month- Tools
- Download (21.69KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- DBIx::Class
- DBIx::Class::TimeStamp
- DateTime
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- DATETIME::FORMAT DEPENDENCY
- DESCRIPTION
- METHODS
- SEE ALSO
- AUTHORS
- COPYRIGHT AND LICENSE
NAME
DBIx::Class::DateTime::Epoch - Automatic inflation/deflation of epoch-based columns to/from DateTime objects
SYNOPSIS
package MySchema::Foo; use base qw( DBIx::Class ); __PACKAGE__->load_components( qw( DateTime::Epoch TimeStamp Core ) ); __PACKAGE__->add_columns( name => { data_type => 'varchar', size => 10, }, bar => { # epoch stored as an int data_type => 'bigint', inflate_datetime => 1, }, baz => { # epoch stored as a string data_type => 'varchar', size => 50, inflate_datetime => 'epoch', }, # working in conjunction with DBIx::Class::TimeStamp creation_time => { data_type => 'bigint', inflate_datetime => 1, set_on_create => 1, }, modification_time => { data_type => 'bigint', inflate_datetime => 1, set_on_create => 1, set_on_update => 1, } );
DATETIME::FORMAT DEPENDENCY
There have been no assumptions made as to what RDBMS you will be using. As per the note in the DBIx::Class::InflateColumn::DateTime documentation, you will need to install the DateTime::Format::* module that matches your RDBMS of choice.
DESCRIPTION
This module automatically inflates/deflates DateTime objects from/to epoch values for the specified columns. This module is essentially an extension to DBIx::Class::InflateColumn::DateTime so all of the settings, including
locale
andtimezone
, are also valid.A column will be recognized as an epoch time given one of the following scenarios:
data_type
is anint
of some sort andinflate_datetime
is also set to a true valuedata_type
is some other value (e.g.varchar
) andinflate_datetime
is explicitly set toepoch
.
DBIx::Class::TimeStamp can also be used in conjunction with this module to support epoch-based columns that are automatically set on creation of a row and updated subsequent modifications.
METHODS
add_columns( )
Provides backwards compatibility with the older DateTime::Epoch API.
_inflate_to_datetime( )
Overrides column inflation to use
Datetime->from_epoch
._deflate_from_datetime( )
Overrides column deflation to call
epoch()
on the column value.SEE ALSO
AUTHORS
Brian Cassidy <bricas@cpan.org>
Adam Paynter <adapay@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2006-2012 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install DBIx::Class::DateTime::Epoch, copy and paste the appropriate command in to your terminal.
cpanm DBIx::Class::DateTime::Epoch
perl -MCPAN -e shell install DBIx::Class::DateTime::Epoch
For more information on module installation, please visit the detailed CPAN module installation guide.