in connectors/grafana-plugin/pkg/plugin/plugin.go [166:208]
func verifyQuery(query backend.DataQuery) (qp *queryParam, errMsg string) {
err := json.Unmarshal(query.JSON, &qp)
if err != nil {
return nil, ""
}
if qp.Hide {
return nil, "none"
}
if qp.SqlType == "SQL: Drop-down List" {
if len(qp.Paths) < 1 {
return nil, "Input error, please select TIME-SERIES"
}
if qp.GroupBy.SamplingInterval != "" && qp.AggregateFun == "" {
return nil, "Input error, please select FUNCTION when SAMPLING INTERVAL has a value"
}
} else if qp.SqlType == "SQL: Full Customized" {
if len(qp.Expression) == 0 {
return nil, "Input error, SELECT is required"
}
for i := 0; i < len(qp.Expression); i++ {
if qp.Expression[i] == "" {
return nil, "Input error, SELECT is required"
}
}
if len(qp.PrefixPath) == 0 {
return nil, "Input error, FROM is required"
}
for i := 0; i < len(qp.PrefixPath); i++ {
if qp.PrefixPath[i] == "" {
return nil, "Input error, FROM is required"
}
}
} else {
return nil, "none"
}
return qp, ""
}