Skip to content

Commit c4a55dc

Browse files
committed
Moves generation of aggregation function alias to builder
1 parent 859ee4e commit c4a55dc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/AggregateFunctions.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ function AggregateFunctions(opts) {
1616
var args = (arguments.length && Array.isArray(arguments[0]) ? arguments[0] : Array.prototype.slice.apply(arguments));
1717

1818
if (args.length > 0) {
19-
aggregates[aggregates.length - 1].push({ f: fun, a: args });
19+
aggregates[aggregates.length - 1].push({ f: fun, a: args, alias: aggregateAlias(fun, args) });
2020
aggregates.push([]);
2121
} else {
22-
aggregates[aggregates.length - 1].push({ f: fun });
22+
aggregates[aggregates.length - 1].push({ f: fun, alias: aggregateAlias(fun, args) });
2323
}
2424

2525
return proto;
@@ -58,7 +58,6 @@ function AggregateFunctions(opts) {
5858

5959
for (var i = 0; i < aggregates.length; i++) {
6060
for (var j = 0; j < aggregates[i].length; j++) {
61-
aggregates[i][j].alias = aggregateAlias(aggregates[i][j].f, aggregates[i][j].a);
6261
query[aggregates[i][j].f](aggregates[i][j].a, aggregates[i][j].alias);
6362
}
6463
}

0 commit comments

Comments
 (0)