Debian Codegraph @

README

raw
1 NAME
2 DBIx::Class::DateTime::Epoch - Automatic inflation/deflation of
3 epoch-based columns to/from DateTime objects
4
5 SYNOPSIS
6 package MySchema::Foo;
7
8 use base qw( DBIx::Class );
9
10 __PACKAGE__->load_components( qw( DateTime::Epoch TimeStamp Core ) );
11 __PACKAGE__->add_columns(
12 name => {
13 data_type => 'varchar',
14 size => 10,
15 },
16 bar => { # epoch stored as an int
17 data_type => 'bigint',
18 inflate_datetime => 1,
19 },
20 baz => { # epoch stored as a string
21 data_type => 'varchar',
22 size => 50,
23 inflate_datetime => 'epoch',
24 },
25 # working in conjunction with DBIx::Class::TimeStamp
26 creation_time => {
27 data_type => 'bigint',
28 inflate_datetime => 1,
29 set_on_create => 1,
30 },
31 modification_time => {
32 data_type => 'bigint',
33 inflate_datetime => 1,
34 set_on_create => 1,
35 set_on_update => 1,
36 }
37 );
38
39 DATETIME::FORMAT DEPENDENCY
40 There have been no assumptions made as to what RDBMS you will be using.
41 As per the note in the DBIx::Class::InflateColumn::DateTime
42 documentation, you will need to install the DateTime::Format::* module
43 that matches your RDBMS of choice.
44
45 DESCRIPTION
46 This module automatically inflates/deflates DateTime objects from/to
47 epoch values for the specified columns. This module is essentially an
48 extension to DBIx::Class::InflateColumn::DateTime so all of the
49 settings, including "locale" and "timezone", are also valid.
50
51 A column will be recognized as an epoch time given one of the following
52 scenarios:
53
54 * "data_type" is an "int" of some sort and "inflate_datetime" is also
55 set to a true value
56
57 * "data_type" is some other value (e.g. "varchar") and
58 "inflate_datetime" is explicitly set to "epoch".
59
60 DBIx::Class::TimeStamp can also be used in conjunction with this module
61 to support epoch-based columns that are automatically set on creation of
62 a row and updated subsequent modifications.
63
64 METHODS
65 add_columns( )
66 Provides backwards compatibility with the older DateTime::Epoch API.
67
68 _inflate_to_datetime( )
69 Overrides column inflation to use "Datetime->from_epoch".
70
71 _deflate_from_datetime( )
72 Overrides column deflation to call "epoch()" on the column value.
73
74 SEE ALSO
75 * DBIx::Class
76
77 * DBIx::Class::TimeStamp
78
79 * DateTime
80
81 AUTHORS
82 Brian Cassidy <[email protected]>
83
84 Adam Paynter <[email protected]>
85
86 COPYRIGHT AND LICENSE
87 Copyright 2006-2012 by Brian Cassidy
88
89 This library is free software; you can redistribute it and/or modify it
90 under the same terms as Perl itself.
91