Add /explain endpoint
This commit is contained in:
parent
d786919a36
commit
e2bc79f686
11
api.go
11
api.go
@ -22,6 +22,17 @@ func API_RunQuery(c *gin.Context) {
|
||||
API_HandleQuery(query, c)
|
||||
}
|
||||
|
||||
func API_ExplainQuery(c *gin.Context) {
|
||||
query := strings.TrimSpace(c.Request.FormValue("query"))
|
||||
|
||||
if query == "" {
|
||||
c.JSON(400, errors.New("Query parameter is missing"))
|
||||
return
|
||||
}
|
||||
|
||||
API_HandleQuery(fmt.Sprintf("EXPLAIN %s", query), c)
|
||||
}
|
||||
|
||||
func API_GetTables(c *gin.Context) {
|
||||
names, err := dbClient.Tables()
|
||||
|
||||
|
2
main.go
2
main.go
@ -72,6 +72,8 @@ func main() {
|
||||
router.GET("/tables/:table/indexes", API_TableIndexes)
|
||||
router.GET("/query", API_RunQuery)
|
||||
router.POST("/query", API_RunQuery)
|
||||
router.GET("/explain", API_ExplainQuery)
|
||||
router.POST("/explain", API_ExplainQuery)
|
||||
router.GET("/history", API_History)
|
||||
router.Static("/app", options.Static)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user