// QueryData handles multiple queries and returns multiple responses.
// req contains the queries []DataQuery (where each query contains RefID as a unique identifier).
// The QueryDataResponse contains a map of RefID to the response for each query, and each response
// contains Frames ([]*Frame).
QueryData handles multiple queries and returns multiple responses.
req contains the queries []DataQuery (where each query contains RefID as a unique identifier).
The QueryDataResponse contains a map of RefID to the response for each query, and each response
contains Frames ([]*Frame).
// QueryData handles multiple queries and returns multiple responses . // req contains the queries [] DataQuery ( where each query contains RefID as a unique identifier ) . // The QueryDataResponse contains a map of RefID to the response for each query and each response // contains Frames ( [] * Frame ) .
func (d *CouchbaseDatasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
  defer func() {
    if err := recover(); err != nil {
      log.DefaultLogger.Error(fmt.Sprintf("Panic occured: %v", err))
      debug.PrintStack()
      panic(err)
    }
  }()
  log.DefaultLogger.Info("QueryData called", "request", fmt.Sprintf("%+v", req))
	response := backend.NewQueryDataResponse()
	for _, q := range req.Queries {
    log.DefaultLogger.Info("Processing query", "refId", q.RefID, "TYPE: " + q.QueryType)
    h := sha1.New()
    h.Write([]byte(q.JSON))
    query := parseQuery(q.JSON)
    query.Range = q.TimeRange
    response.Responses[q.RefID] = d.query(nil, &query)
	}
	return response, nil
}
func ( d * CouchbaseDatasource ) QueryData ( ctx context . Context , req * backend . QueryDataRequest ) ( * backend . QueryDataResponse , error ) { defer func ( ) { if err := recover ( ) ; err != nil { log . DefaultLogger . Error ( fmt . Sprintf ( " " , err ) ) debug . PrintStack ( ) panic ( err ) } } ( ) log . DefaultLogger . Info ( " " , " " , fmt . Sprintf ( " " , req ) ) response := backend . NewQueryDataResponse ( ) for _ , q := range req . Queries { log . DefaultLogger . Info ( " " , " " , q . RefID , " " + q . QueryType ) h := sha1 . New ( ) h . Write ( [ ] byte ( q . JSON ) ) query := parseQuery ( q . JSON ) query . Range = q . TimeRange response . Responses [ q . RefID ] = d . query ( nil , & query ) } return response , nil }
QueryData handles multiple queries and returns multiple responses.
QueryData handles multiple queries and returns multiple responses .
// create response struct // loop over queries and execute them individually. //channel := "ds/" + d.Instance.UID + "/" + query.Key //channels[channel] = &query // channels are unstable