SearchV2: move search parameters to a nested object (#50561)

This commit is contained in:
Ryan McKinley
2022-06-10 11:06:41 -07:00
committed by GitHub
parent 5af04cf81d
commit b6f97e8101
5 changed files with 129 additions and 95 deletions
+7 -3
View File
@@ -156,13 +156,17 @@ func (s *Service) doRandomWalk(query backend.DataQuery) backend.DataResponse {
}
func (s *Service) doSearchQuery(ctx context.Context, req *backend.QueryDataRequest, query backend.DataQuery) backend.DataResponse {
q := searchV2.DashboardQuery{}
err := json.Unmarshal(query.JSON, &q)
m := requestModel{}
err := json.Unmarshal(query.JSON, &m)
if err != nil {
return backend.DataResponse{
Error: err,
}
}
return *s.search.DoDashboardQuery(ctx, req.PluginContext.User, req.PluginContext.OrgID, m.Search)
}
return *s.search.DoDashboardQuery(ctx, req.PluginContext.User, req.PluginContext.OrgID, q)
type requestModel struct {
QueryType string `json:"queryType"`
Search searchV2.DashboardQuery `json:"search,omitempty"`
}