3.0 better count

Improved the `Query::count()` method. Now it will work consistently when having `group by` or any formatting function. Also added a way to register a callback that will be used instead of Query::count() when present, this allows to have full control over the count query or to just return an estimated number of rows.