mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 21:12:09 +03:00
a8cee16ab5
* support for count and aggregations on columns, close #786 * support explain query for aggregations * '<arr-rel>_agg' in '<table>' type, fix order by for aggregations * add 'allow_aggregations' key in select permissions * Add checkbox to toggle count and aggregations on columns on select permission * align aggregation checkbox with columns div * improve readability of the generated sql * alias is needed at the top level aggregation * throw internal errors for unexpected fields * rename SelFld to more readable TableAggFld * rename agg to aggregate
189 lines
4.0 KiB
YAML
189 lines
4.0 KiB
YAML
descriptions: Select aggregations on article table along with it's nodes where id > 1
|
|
url: /v1alpha1/graphql
|
|
status: 200
|
|
response:
|
|
data:
|
|
article_aggregate:
|
|
aggregate:
|
|
count: 2
|
|
sum:
|
|
id: 5
|
|
id_sum: 5
|
|
author_id: 3
|
|
author_id_sum: 3
|
|
sum_fields:
|
|
id: 5
|
|
id_sum: 5
|
|
author_id: 3
|
|
author_id_sum: 3
|
|
avg:
|
|
id: 2.5
|
|
id_avg: 2.5
|
|
author_id: 1.5
|
|
author_id_avg: 1.5
|
|
avg_fields:
|
|
id: 2.5
|
|
id_avg: 2.5
|
|
author_id: 1.5
|
|
author_id_avg: 1.5
|
|
max:
|
|
id: 3
|
|
id_max: 3
|
|
title: Article 3
|
|
title_max: Article 3
|
|
content: Sample article content 3
|
|
content_max: Sample article content 3
|
|
author_id: 2
|
|
author_id_max: 2
|
|
max_fields:
|
|
id: 3
|
|
id_max: 3
|
|
title: Article 3
|
|
title_max: Article 3
|
|
content: Sample article content 3
|
|
content_max: Sample article content 3
|
|
author_id: 2
|
|
author_id_max: 2
|
|
min:
|
|
id: 2
|
|
id_min: 2
|
|
title: Article 2
|
|
title_min: Article 2
|
|
content: Sample article content 2
|
|
content_min: Sample article content 2
|
|
author_id: 1
|
|
author_id_min: 1
|
|
min_fields:
|
|
id: 2
|
|
id_min: 2
|
|
title: Article 2
|
|
title_min: Article 2
|
|
content: Sample article content 2
|
|
content_min: Sample article content 2
|
|
author_id: 1
|
|
author_id_min: 1
|
|
nodes:
|
|
- id: 2
|
|
title: Article 2
|
|
content: Sample article content 2
|
|
is_published: true
|
|
author:
|
|
id: 1
|
|
name: Author 1
|
|
- id: 3
|
|
title: Article 3
|
|
content: Sample article content 3
|
|
is_published: true
|
|
author:
|
|
id: 2
|
|
name: Author 2
|
|
articles:
|
|
- id: 2
|
|
title: Article 2
|
|
content: Sample article content 2
|
|
is_published: true
|
|
author:
|
|
id: 1
|
|
name: Author 1
|
|
- id: 3
|
|
title: Article 3
|
|
content: Sample article content 3
|
|
is_published: true
|
|
author:
|
|
id: 2
|
|
name: Author 2
|
|
|
|
query:
|
|
query: |
|
|
query{
|
|
article_aggregate(where: {id: {_gt: 1}}){
|
|
aggregate{
|
|
count
|
|
sum{
|
|
id
|
|
id_sum: id
|
|
author_id
|
|
author_id_sum: author_id
|
|
}
|
|
sum_fields: sum{
|
|
id
|
|
id_sum: id
|
|
author_id
|
|
author_id_sum: author_id
|
|
}
|
|
avg{
|
|
id
|
|
id_avg: id
|
|
author_id
|
|
author_id_avg: author_id
|
|
}
|
|
avg_fields: avg{
|
|
id
|
|
id_avg: id
|
|
author_id
|
|
author_id_avg: author_id
|
|
}
|
|
max{
|
|
id
|
|
id_max: id
|
|
title
|
|
title_max: title
|
|
content
|
|
content_max: content
|
|
author_id
|
|
author_id_max: author_id
|
|
}
|
|
max_fields: max{
|
|
id
|
|
id_max: id
|
|
title
|
|
title_max: title
|
|
content
|
|
content_max: content
|
|
author_id
|
|
author_id_max: author_id
|
|
}
|
|
min{
|
|
id
|
|
id_min: id
|
|
title
|
|
title_min: title
|
|
content
|
|
content_min: content
|
|
author_id
|
|
author_id_min: author_id
|
|
}
|
|
min_fields: min{
|
|
id
|
|
id_min: id
|
|
title
|
|
title_min: title
|
|
content
|
|
content_min: content
|
|
author_id
|
|
author_id_min: author_id
|
|
}
|
|
}
|
|
nodes{
|
|
id
|
|
title
|
|
content
|
|
is_published
|
|
author{
|
|
id
|
|
name
|
|
}
|
|
}
|
|
articles: nodes{
|
|
id
|
|
title
|
|
content
|
|
is_published
|
|
author{
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|