[DBIx-Class-Devel] [dbsrgits/dbix-class] Scalar::Defer support as column name (#98)

x86-64 notifications at github.com
Wed Mar 30 11:55:57 GMT 2016


Well I'm using it to work with joins in dbix-class, looks like this:

    use DBIx::Class::Helper::XJoin;
    my $rs = $schema->resultset('Project');
    xjoin($rs,                 
        "parent.tags as tag1",        
        "parent.tags as tag2",        
        "tags as tag3", 
    );
    $rs->search([
        xjoin_column_alias("parent.tag1.name") => "Open",
        xjoin_column_alias("parent.tag2.name") => "Public",
        xjoin_column_alias("tag3.name")        => "Private",
    ]);

xjoin_column_alias returns object from Scalar::Defer, so it basically boils down to:

      use Scalar::Defer qw/defer/;
      my $rs = $schema->resultset('Project');
      $rs->search([
           defer { "column" } => "value",
      ]);

Does it make any sense?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/dbix-class/pull/98#issuecomment-203396099
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20160330/457ebfdd/attachment.htm>


More information about the DBIx-Class-Devel mailing list