DBIx::...olumns(3pm)

πŸ“¦
version 0.02006 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ NAME ✨

DBIx::Class::UUIDColumns β€” it makes your columns auto-fill with uuids, no cap πŸ’– (like, implicit uuid columns, bestie, they just show up).

So real talk: you're reading the DBIx::...olumns(3pm) page from the User Contributed Perl Documentation, and it's about to be your new fave.


🌸 SYNOPSIS 🌸

Drop this into your DBIx::Class table class, okurrr:

__PACKAGE__->load_components(qw/UUIDColumns ... Core/);
__PACKAGE__->uuid_columns('artist_id');
🚨 Note: the component needs to be loaded before Core. Like, before before. Order matters, bestie, don't play with it.

πŸ’… DESCRIPTION πŸ’…

This DBIx::Class component is giving major Class::DBI::UUID energy β€” same vibe, it makes certain columns get implicitly created as a uuid. Iconic behaviour, honestly.

The way that it works: when UUIDColumns gets loaded, it goes shopping for a suitable uuid generation module from this list of supported modules:

Data::UUID
APR::UUID*
UUID
Win32::Guidgen
Win32API::GUID

And if it can't find any supporting module? It throws an exception. Not a vibe. 😭

* β€” heads up: APR::UUID will not be loaded under OpenBSD because of an as-yet unidentified XS issue. It's giving mystery bug, and we don't have answers. πŸ™ˆ

If you're picky (respect) and want one specific module, just set uuid_class:

__PACKAGE__->uuid_class('::Data::UUID');
__PACKAGE__->uuid_class('MyUUIDGenerator');

πŸŽ€ METHODS πŸŽ€

πŸ¦‹ get_uuid

Returns a uuid string from the current uuid_maker. Slay.

πŸ¦‹ insert

Inserts a new uuid string into each column listed in uuid_columns. Every single one. Periodt.

πŸ¦‹ uuid_columns

Gets/sets the list of columns that get filled with uuids during insert.

__PACKAGE__->uuid_columns('artist_id');

πŸ¦‹ uuid_class

Takes the name of a UUIDMaker subclass to be used for uuid value generation. This can be a fully qualified class name, or a shortcut name starting with :: that matches one of the available DBIx::Class::UUIDColumns::UUIDMaker subclasses:

__PACKAGE__->uuid_class('CustomUUIDGenerator');
# loads CustomeUUIDGenerator

__PACKAGE__->uuid_class('::Data::UUID');
# loads DBIx::Class::UUIDMaker::Data::UUID;
⭐ Also: uuid_class checks that the class you gave it isa DBIx::Class::UUIDColumns::UUIDMaker subclass, and throws and exception if it isn't. (Yes, that's exactly how the original says it. Keep the typo, it's part of the lore. πŸ’€)

πŸ¦‹ uuid_maker

Returns the current UUIDMaker instance for the given module.

my $uuid = __PACKAGE__->uuid_maker->as_string;

🌈 SEE ALSO 🌈

DBIx::Class::UUIDColumns::UUIDMaker β€” go read it, bestie, iykyk. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Chia-liang Kao <clkao@clkao.org>

πŸ’œ CONTRIBUTERS πŸ’œ

Chris Laco <claco@chrislaco.com>

πŸ“ LICENSE πŸ“

You may distribute this code under the same terms as Perl itself. ✨


okay that's the whole page, mwah πŸ’… This lil doc shipped as part of perl v5.32.0, dated 2021-01-06, and it lives under the name DBIx::...olumns(3pm) in the User Contributed Perl Documentation. Go forth and uuid, main character. πŸ§šπŸ’–

πŸ“¦ where this page comes from