ReviewOS

stacks/bun-query-builder

withSum/withAvg/withMax + per-relation constraint callback on withCount

#1046
Closed glennmichael123 opened this 22 days ago · 0 comments
22 days ago

Summary

withCount(...relations: string[]) exists but only accepts relation names — no per-relation constraint callback (Eloquent's withCount(['comments' => fn])) and no aggregate siblings. The subquery builders (buildHasCountSubquery, buildBelongsToManyCountSubquery) are already factored, so adding withSum(relation, col) / withAvg / withMax / withMin and an optional callback arg is incremental.

Effort: M. Location: src/client.ts:~3519. High Eloquent-parity value. Found via internal code audit.

Sign in to comment on this issue.