frioux / DBIx-Class-Helpers

https://metacpan.org/pod/DBIx::Class::Helpers
20 stars 38 forks source link

correlate `AS fieldname` #65

Open mrenvoize opened 8 years ago

mrenvoize commented 8 years ago

As discussed on IRC 16.52 June 9th 2016, it would be nice to allow for 'nameing a correlate field at the database level' to allow for sorting on the correlate result.

We discussed adding the following to the correlate call syntax:

 $rs->correlate('foo', { as => 'foo' });
mrenvoize commented 8 years ago

Related gists: https://gist.github.com/frioux/b48cf38da1aa7ecdb8839af32b1c5358, https://gist.github.com/mrenvoize/6e8aba1a8298ffb9b9fa23faea7fafb2

mrenvoize commented 8 years ago

Seems the above syntax 'aint possible'.. so there was talk about creating a new piece to ::Helper:ResultSet::Util

 $rs->as($as_query, 'newalias');