Jifty:...::Union(3pm)
β¨ Jifty::DBI::Collection::Union β the manual page bestie π
okay so this is Jifty:...::Union(3pm) from the User Contributed Perl Documentation, and it's literally the "smoosh all ur result sets together" module. let's get into it π«Ά
πΈ NAME πΈ
Jifty::DBI::Collection::Union β deal with multiple Jifty::DBI::Collection result sets as one π
like, one list to rule them all. no cap.
β¨ SYNOPSIS β¨
use Jifty::DBI::Collection::Union;
my $U = new Jifty::DBI::Collection::Union;
$U->add( $tickets1 );
$U->add( $tickets2 );
$U->GotoFirstItem;
while (my $z = $U->Next) {
printf "%5d %30.30s\n", $z->Id, $z->Subject;
}
see how we just... stacked $tickets1 and $tickets2 into one thing and then iterated like it was always one collection? that's the whole vibe. main character energy fr fr π
π WARNING π
This module is still experimental. π
like it works but also. bestie. be aware.
π DESCRIPTION π
so what this actually does: it implements a subset of the Jifty::DBI::Collection methods β not all of them, just enough to do iteration over a bunch of results π¦.
it's useful for displaying the results of two unrelated searches (for the same kind of objects) in a single list. iconic behaviour honestly.
π METHODS π
π new
Create a new Jifty::DBI::Collection::Union object. No arguments.
that's it. that's the whole thing. so simple, so clean β¨
π§ add COLLECTION
Add Jifty::DBI::Collection object COLLECTION to the Union object.
It must be the same type as the first object added. β οΈ
like don't be out here mixing object types, the Union will simply not have it π
πΈ first
Return the very first element of the Union (which is the first element of the first Collection). Also reset the current pointer to that element.
so it returns it and rewinds u there. two-for-one π
β next
Return the next element in the Union.
just vibing forward through the list, one item at a time π¦
π₯ last
Returns the last item.
the final boss. the end of the list. periodt.
π count
Returns the total number of elements in the union collection.
yes bestie we're counting everything across all the smooshed-together collections π
π goto_first_item
Starts the recordset counter over from the first item. the next time you call next, you'll get the first item returned by the database, as if you'd just started iterating through the result set.
it's giving "rewind the tape" πΌβ¨
π goto_item
Unlike goto_item in Jifty::DBI::Collection, Union only supports going to the first item in the collection.
yeah. it's a limited edition. only one destination. no cap.
π is_last
Returns true if the current row is the last record in the set.
perfect for those "am I done yet" moments π
π«Ά items_array_ref
Return a reference to an array containing all objects found by this search.
Will destroy any positional state. π
so like, u get the whole array, but ur current position? gone. evaporated. consider urself warned π
π AUTHOR π
Copyright (c) 2004 Robert Spier
All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
shoutout Robert Spier for this 2004 banger π«Ά
π¦ SEE ALSO π¦
Jifty::DBIJifty::DBI::Collection
go read those too, they're the parents of this whole situation iykyk π
and that's the page bestie!! perl v5.34.0, dated 2022-06-15, straight from the User Contributed Perl Documentation. slay, go union some collections π β¨π
π¦ where this page comes from
- debian bookworm: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libjifty-dbi-perl 0.78-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libjifty-dbi-perl 0.78-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