logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

DBIx::SearchBuilder::Unique - Ensure uniqueness of records in a collection

Description

       Currently, DBIx::SearchBuilder makes exceptions for databases which cannot handle both "SELECT DISTINCT"
       and ordering in the same statement; it drops the "DISTINCT" requirement. This, of course, means that you
       can get the same row twice, which you might not want. If that's the case, use this module as a mix-in,
       and it will provide you with an "AddRecord" method which ensures that a record will not appear twice in
       the same search.

perl v5.38.2                                       2024-05-15                   DBIx::SearchBuilder::Unique(3pm)

Name

       DBIx::SearchBuilder::Unique - Ensure uniqueness of records in a collection

Synopsis

           package Foo::Collection;
           use base 'DBIx::SearchBuilder';

           use DBIx::SearchBuilder::Unique; # mixin

           my $collection = Foo::Collection->New();
           $collection->SetupComplicatedJoins;
           $collection->OrderByMagic;

           while (my $thing = $collection->Next) {
               # $thing is going to be distinct
           }

See Also