update inteface{} usage in query with `any` for clarity.
This commit is contained in:
parent
7900ccfeb6
commit
0f6e735e3a
|
@ -41,6 +41,10 @@ const TABLE_ALIAS = "fhir"
|
|||
// Can generate simple or complex queries, depending on the SearchParameter type:
|
||||
//
|
||||
// eg. Simple
|
||||
// SELECT fhir.*
|
||||
// FROM fhir_observation as fhir, json_each(fhir.code) as codeJson
|
||||
//
|
||||
// result = inteface{} ([]database.IFhirResource)
|
||||
//
|
||||
// eg. Complex
|
||||
// SELECT fhir.*
|
||||
|
@ -54,6 +58,8 @@ const TABLE_ALIAS = "fhir"
|
|||
// )
|
||||
// AND (user_id = "6efcd7c5-3f29-4f0d-926d-a66ff68bbfc2")
|
||||
// GROUP BY `fhir`.`id`
|
||||
//
|
||||
// results = []map[string]any{}
|
||||
func (gr *GormRepository) QueryResources(ctx context.Context, query models.QueryResource) (interface{}, error) {
|
||||
|
||||
sqlQuery, err := gr.sqlQueryResources(ctx, query)
|
||||
|
@ -62,7 +68,7 @@ func (gr *GormRepository) QueryResources(ctx context.Context, query models.Query
|
|||
}
|
||||
|
||||
if query.Aggregations != nil && (query.Aggregations.GroupBy != nil || query.Aggregations.CountBy != nil) {
|
||||
results := []map[string]interface{}{}
|
||||
results := []map[string]any{}
|
||||
clientResp := sqlQuery.Find(&results)
|
||||
return results, clientResp.Error
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ type QueryResourceAggregations struct {
|
|||
|
||||
type QueryResourceAggregation struct {
|
||||
Field string `json:"field"`
|
||||
Function string `json:"fn"`
|
||||
Function string `json:"fn"` //built-in SQL aggregation functions (eg. Count, min, max, etc).
|
||||
}
|
||||
|
||||
func (q *QueryResource) Validate() error {
|
||||
|
|
Loading…
Reference in New Issue