meteficha/esqueleto — pull request #11 by maoe (2013-03-07 11:28:51+00:00)
Title: Add support for COUNT(expr)

I've added `count` method which takes a column name as an `expr (Value typ)`. This would be useful when we'd like to count aggregated rows on `OUTER JOIN`'ed table like this:

```haskell
ret <- select $
from $ \(p `LeftOuterJoin` b) -> do
on (p ^. PersonId ==. b ^. BlogPostAuthorId)
groupBy (p ^. PersonId)
let cnt = count (b ^. BlogPostId)
orderBy [ asc cnt ]
return (p, cnt)
```
generates
```sql
SELECT "Person"."id", "Person"."name", "Person"."age", COUNT("BlogPost"."id")
FROM "Person" LEFT OUTER JOIN "BlogPost" ON "Person"."id" = "BlogPost"."authorId"
GROUP BY "Person"."id"
ORDER BY COUNT("BlogPost"."id") ASC
```