Open deekerno opened 12 months ago
@deekerno
aggregate$Entity {
$field$Operation
}
aggregate
prefix denotes the user wants to perform an aggregation$Entity
is just the PascalCase
entity name$field
is the camelCase
field on the $Entity
$Operation
is one value from some discrete set of operations (e.g., min, max, sum, avg, ...)Am I thinking about this correctly?
aggregateFoo
or a suffix? fooAggregate
fooAggregate() { }
the fact that it's an aggregation is implied by the field/node name (fooAggregate
) thus you only need to name the reducer inside the node (e.g., fooAggregate() { count }
)
Aggregate queries allow for the return of statistical summaries of records that match certain criteria. For example, one may want to get the count of all transactions in the network. We could support the request with something like the following GraphQL query:
Additionally, we could allow for advanced aggregate queries by only allowing for certain inputs depending on the entity type and its fields. Here are a few example queries:
Get the average amount per transaction
Get the min, max, total, and average of all contract balances
Here is some prior work from which we can take inspiration.