DBIx::...eStamp(3pm)
π NAME π
DBIx::Class::TimeStamp β it's a DBIx::Class extension that handles your date-and-time fields for you, so you literally never have to think about them again. Bestie, it just works. β¨
It lives in the DBIx::...eStamp(3pm) manual, part of the User Contributed Perl Documentation, and it's about to be your new fave.
π¦ DESCRIPTION π¦
Okay so, picture this: it works in conjunction with InflateColumn::DateTime to automatically set your update and create date-and-time-based fields in a table. Like, you declare intent once and the timestamps justβ¦ appear. Obsessed. π
β¨ SYNOPSIS β¨
Set it up in your schema package like this, no cap:
package My::Schema;
__PACKAGE__->load_components(qw( TimeStamp ... Core ));
__PACKAGE__->add_columns(
id => { data_type => 'integer' },
t_created => { data_type => 'datetime', set_on_create => 1 },
t_updated => { data_type => 'datetime',
set_on_create => 1, set_on_update => 1 },
);
So now β any update or create action will update the specified columns with the current time, using the DateTime inflator. She's doing it all by herself. π
And like, this is effectively trigger emulation, the whole point being to get consistent behavior across databases that either implement triggers poorly or literally not at all. Cross-database consistency? Ate. π
π METHODS π
π get_timestamp
Returns a DateTime object pointing to now. That's it. That's the whole vibe.
Override this method if you have different time accounting functions, or you want to do anything special β go off, customise it however you need, the code supports you. π«Ά
The date and time objects in the database are expected to be inflated. As such you can be pretty flexible with what you want to return here. Sky's the limit fr fr. π
π AUTHOR π
J. Shirley <jshirley@gmail.com>
πΈ CONTRIBUTORS πΈ
- Florian Ragwitz (Porting to
DBIx::Class::DynamicDefault) - LTJake/bricas
π COPYRIGHT & LICENSE π
Copyright 2009 J. Shirley, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π Real talk though: that copyright line and that license line are the legal whole story, so don't skip 'em just because they're not the fun part. Periodt.
okay bestie that's the whole page, mwah π this version came from perl v5.38.2 and was dated 2024-03-05 β no thoughts, just DBIx::...eStamp(3pm) energy, slay β¨ππ¦
π¦ where this page comes from
- debian trixie: libdbix-class-timestamp-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdbix-class-timestamp-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbix-class-timestamp-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbix-class-timestamp-perl 0.14-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms