Add endpoint to fetch table indexes

This commit is contained in:
Dan Sosedoff
2014-10-11 13:20:16 -05:00
parent aca2b473b6
commit d786919a36
3 changed files with 28 additions and 5 deletions

13
api.go
View File

@@ -34,7 +34,7 @@ func API_GetTables(c *gin.Context) {
}
func API_GetTable(c *gin.Context) {
res, err := dbClient.Query(fmt.Sprintf(SQL_TABLE_SCHEMA, c.Params.ByName("name")))
res, err := dbClient.Query(fmt.Sprintf(SQL_TABLE_SCHEMA, c.Params.ByName("table")))
if err != nil {
c.JSON(400, NewError(err))
@@ -59,6 +59,17 @@ func API_Info(c *gin.Context) {
c.JSON(200, res.Format()[0])
}
func API_TableIndexes(c *gin.Context) {
res, err := dbClient.TableIndexes(c.Params.ByName("table"))
if err != nil {
c.JSON(400, NewError(err))
return
}
c.JSON(200, res)
}
func API_HandleQuery(query string, c *gin.Context) {
result, err := dbClient.Query(query)