Skip to content

Commit

Permalink
starting to work on GroupBy aggregations
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Aug 14, 2023
1 parent 1f113cd commit 495fce5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions backend/pkg/models/query_resource.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
package models

type QueryResourceAggregationType string

const (
QueryResourceAggregationTypeCountBy QueryResourceAggregationType = "countBy"
QueryResourceAggregationTypeGroupBy QueryResourceAggregationType = "groupBy"
QueryResourceAggregationTypeMinBy QueryResourceAggregationType = "minBy"
QueryResourceAggregationTypeMaxBy QueryResourceAggregationType = "maxBy"
)

// maps to frontend/src/app/models/widget/dashboard-widget-query.ts
type QueryResource struct {
Use string `json:"use"`
Select []string `json:"select"`
From string `json:"from"`
Where map[string]interface{} `json:"where"`

//aggregation fields
AggregationParams []string `json:"aggregation_params"`
AggregationType *QueryResourceAggregationType `json:"aggregation_type"`
}
2 changes: 1 addition & 1 deletion frontend/src/app/models/widget/dashboard-widget-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export class DashboardWidgetQuery {

//https://lodash.com/docs/4.17.15#unionBy
aggregation_params?: string[]
aggregation_type?: 'countBy' | 'unionBy' | 'groupBy' | 'orderBy' | 'sortBy' | 'minBy' | 'maxBy' | 'sumBy'
aggregation_type?: 'countBy' | 'groupBy' // | 'minBy' | 'maxBy' | 'sumBy' // 'orderBy' | 'sortBy' |
}

0 comments on commit 495fce5

Please # to comment.