Add /tables/:name/info endpoint to get table data details

This commit is contained in:
Dan Sosedoff 2014-10-17 20:30:08 -07:00
parent abfd6dd688
commit 21bcc6e4b8
2 changed files with 12 additions and 0 deletions

11
api.go
View File

@ -89,6 +89,17 @@ func API_GetTable(c *gin.Context) {
c.JSON(200, res)
}
func API_GetTableInfo(c *gin.Context) {
res, err := dbClient.TableInfo(c.Params.ByName("table"))
if err != nil {
c.JSON(400, NewError(err))
return
}
c.JSON(200, res)
}
func API_History(c *gin.Context) {
c.JSON(200, dbClient.history)
}

View File

@ -82,6 +82,7 @@ func startServer() {
router.GET("/info", API_Info)
router.GET("/tables", API_GetTables)
router.GET("/tables/:table", API_GetTable)
router.GET("/tables/:table/info", API_GetTableInfo)
router.GET("/tables/:table/indexes", API_TableIndexes)
router.GET("/query", API_RunQuery)
router.POST("/query", API_RunQuery)