tusken
tusken copied to clipboard
Warn when aggregate function is used alongside non-aggregate selection
If an aggregate function is used within a db.select call, you need GROUP BY to include non-aggregate selections.
Current progress
- [x] Generated
defineFunctioncalls use theAggregatetype instead ofOutputin their type signatures - [ ] TypeScript emits an error when a selection includes both
Aggregateand non-aggregate types
We'll probably add a groupBy helper function for use in the selector function.
db.select(t.user(user => [
groupBy(user.id),
pg.avg(user.followerCount),
]))