DBIx::C...entifier(3)
π DBIx::Class::Storage::DBI::UniqueIdentifier β the manual, but make it make sense π
okay so bestie, this one is a page from the DBIx::Class docs (perl, obviously π), and it's literally all about giving your database GUIDs without breaking a sweat. Let's get into it β¨
π NAME π
DBIx::Class::Storage::DBI::UniqueIdentifier β the storage component for RDBMSes that support GUID types π«Ά
πΈ DESCRIPTION πΈ
So this is a storage component for databases that support GUID types β think stuff like uniqueidentifier, uniqueidentifierstr, or guid π
And here's the slay part: GUIDs get generated automatically for PK columns that have a supported data_type, and also for non-PK columns with auto_nextval set π₯ No cap, it just does it for you.
β METHODS β
π¦ new_guid
The composing class must set new_guid to whatever method it's using to generate a new GUID. It can also set it to undef β but then the user is required to set it themselves, or a runtime error gets thrown π so like, don't leave it hanging, bestie.
It can be either of these two things:
stringβ in which case it's used as the name of a database function that creates a new GUID πcoderefβ in which case the coderef should return a string GUID, usingData::GUID, or literally whatever GUID generation method you prefer π It gets passed the$selfDBIx::Class::Storagereference as a parameter.
For example:
$schema->storage->new_guid(sub { Data::GUID->new->as_string });
it's giving "one line, does the thing" π obsessed.
π§ FURTHER QUESTIONS? π§
Check the list of additional DBIC resources. (yes that's the whole section, go look it up iykyk π)
π COPYRIGHT AND LICENSE π
This module is free software, copyright by the DBIx::Class (DBIC) authors π You can redistribute it and/or modify it under the same terms as the DBIx::Class library.
and that's the whole page, bestie β no crumbs left behind π
this iconic lil number was served up by perl v5.42.0 on 2025-01-22, and it's brought to you by the DBIx::Class::Storage::DBI::UniqueIdentifier(3) manual page π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-DBIx-Class 0.082844-bp160.1.10 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms