1DBIx::Class::TimeStamp(U3s)er Contributed Perl DocumentatDiBoInx::Class::TimeStamp(3)
2
3
4
6 DBIx::Class::TimeStamp - DBIx::Class extension to update and create
7 date and time based fields
8
10 Works in conjunction with InflateColumn::DateTime to automatically set
11 update and create date and time based fields in a table.
12
14 package My::Schema;
15
16 __PACKAGE__->load_components(qw( TimeStamp ... Core ));
17
18 __PACKAGE__->add_columns(
19 id => { data_type => 'integer' },
20 t_created => { data_type => 'datetime', set_on_create => 1 },
21 t_updated => { data_type => 'datetime',
22 set_on_create => 1, set_on_update => 1 },
23 );
24
25 Now, any update or create actions will update the specified columns
26 with the current time, using the DateTime inflator.
27
28 This is effectively trigger emulation to get consistent behavior across
29 databases that either implement them poorly or not at all.
30
32 get_timestamp
33 Returns a DateTime object pointing to now. Override this method if you
34 have different time accounting functions, or want to do anything
35 special.
36
37 The date and time objects in the database are expected to be inflated.
38 As such you can be pretty flexible with what you want to return here.
39
41 J. Shirley <jshirley@gmail.com>
42
44 Florian Ragwitz (Porting to DBIx::Class::DynamicDefault)
45
46 LTJake/bricas
47
49 Copyright 2009 J. Shirley, all rights reserved.
50
51 This program is free software; you can redistribute it and/or modify it
52 under the same terms as Perl itself.
53
54
55
56perl v5.30.1 2020-01-29 DBIx::Class::TimeStamp(3)