DBIx::...sultSet(3pm)

πŸ“¦
version 2.037000 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ DBIx::Class::Helper::Row::SelfResultSet ✨

okay bestie, welcome to the User Contributed Perl Documentation for DBIx::Class::Helper::Row::SelfResultSet πŸ’– this lil cutie is all about letting you use ResultSet methods on the row you already have, no cap.


🌸 NAME 🌸

DBIx::Class::Helper::Row::SelfResultSet β€” easily use ResultSet methods for the current row. literally that's the whole vibe 🫢


πŸŽ€ SYNOPSIS πŸŽ€

In your result class, you're gonna do this:

__PACKAGE__->load_components('Helper::Row::SelfResultSet');

And then elsewhere (iykyk):

$row->self_rs->$some_rs_method->single

slay. that's it. that's the whole thing πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, sometimes you need a ResultSet that contains literally just the current row. not a big deal, but here's why it's iconic: maybe you've got a ResultSet method that sprinkles in some calculated data β€” like counts of a relationship or whatever. with this you can get at that counted data without duplicating the counting logic. obsessed. no copy-paste, no drama. πŸ’–

but β€” and listen, this is the important part β€” because of the primitives that DBIx::Class::PK hands us, this references the current values, aka, in DBIx::Class terms, the dirty values. which means… if you go and modify the primary columns, it'll be temporarily incorrect 😭

and for what it's worth, the author is not married to this behavior, and would honestly rather you get in touch with him before you depend on it. fr fr, don't build your whole house on this without a lil chat first πŸ™ˆ

πŸ’… METHODS πŸ’…

self_rs

$row->self_rs

returns a ResultSet containing just the current row. that's the tea β˜• one row, one ResultSet, main character energy πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>


This software is copyright (c) 2024 by Arthur Axel "fREW" Schmidt.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page bestie!! πŸŽ€ this was perl v5.40.0, dated 2024-11-16, filed under DBIx::...sultSet(3pm) β€” go forth and self_rs responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from