mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: add Aggregate to <T>Select and <T>Query
This commit is contained in:
committed by
Ariel Mashraki
parent
1bc4d48a51
commit
765ec09d31
@@ -36,8 +36,7 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery() *sql.Selector {
|
||||
for _, fn := range {{ $receiver }}.fns {
|
||||
aggregation = append(aggregation, fn(selector))
|
||||
}
|
||||
// If no columns were selected in a custom aggregation function, the default
|
||||
// selection is the fields used for "group-by", and the aggregation functions.
|
||||
{{- /* If no columns were selected, the default selection is the fields used for "group-by", and the aggregation functions.*/}}
|
||||
if len(selector.SelectedColumns()) == 0 {
|
||||
columns := make([]string, 0, len({{ $receiver }}.fields) + len({{ $receiver}}.fns))
|
||||
for _, f := range {{ $receiver }}.fields {
|
||||
|
||||
Reference in New Issue
Block a user