[Dbix-class] min/max/etc methods?

Brandon Black blblack at gmail.com
Tue Nov 15 20:22:15 CET 2005


I haven't had time to dig into DBIx::Class and figure things out well
enough to be sure I'd be writing it correctly, or I'd just send a
patch, but as it is I'll send a suggestion instead :)

It would be nice if DBIx::Class::Table had more aggregate-style
methods than just "->count".  max and min are probably the most
important/widely-used.  There's also other aggregates like: avg,
stddev, sum, variance, etc.

My::Table::Class->max('userid');
   =>
"SELECT max(userid) FROM atable"

When you consider the number of aggregates out there (and that not all
RDBMS share the same sets of aggregate functions), it kinda begs for a
->aggregate('max','userid') method really, with the most
common/universal ones (count, min, max) as individual methods that
call aggregate().

My $0.02 for the day,
-- Brandon



More information about the Dbix-class mailing list