QueryInspector: add common way to show the raw query (#25204)

This commit is contained in:
Ryan McKinley
2020-05-29 11:06:33 -07:00
committed by GitHub
parent c563633870
commit 2a6ac88a73
15 changed files with 140 additions and 60 deletions

View File

@ -25,6 +25,9 @@ import (
"xorm.io/xorm"
)
// MetaKeyExecutedQueryString is the key where the executed query should get stored
const MetaKeyExecutedQueryString = "executedQueryString"
// SqlMacroEngine interpolates macros into sql. It takes in the Query to have access to query context and
// timeRange to be able to generate queries that use from and to.
type SqlMacroEngine interface {
@ -153,7 +156,7 @@ func (e *sqlQueryEndpoint) Query(ctx context.Context, dsInfo *models.DataSource,
continue
}
queryResult.Meta.Set("sql", rawSQL)
queryResult.Meta.Set(MetaKeyExecutedQueryString, rawSQL)
wg.Add(1)