Add /tables/:name/info endpoint to get table data details
This commit is contained in:
parent
abfd6dd688
commit
21bcc6e4b8
11
api.go
11
api.go
@ -89,6 +89,17 @@ func API_GetTable(c *gin.Context) {
|
|||||||
c.JSON(200, res)
|
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) {
|
func API_History(c *gin.Context) {
|
||||||
c.JSON(200, dbClient.history)
|
c.JSON(200, dbClient.history)
|
||||||
}
|
}
|
||||||
|
1
main.go
1
main.go
@ -82,6 +82,7 @@ func startServer() {
|
|||||||
router.GET("/info", API_Info)
|
router.GET("/info", API_Info)
|
||||||
router.GET("/tables", API_GetTables)
|
router.GET("/tables", API_GetTables)
|
||||||
router.GET("/tables/:table", API_GetTable)
|
router.GET("/tables/:table", API_GetTable)
|
||||||
|
router.GET("/tables/:table/info", API_GetTableInfo)
|
||||||
router.GET("/tables/:table/indexes", API_TableIndexes)
|
router.GET("/tables/:table/indexes", API_TableIndexes)
|
||||||
router.GET("/query", API_RunQuery)
|
router.GET("/query", API_RunQuery)
|
||||||
router.POST("/query", API_RunQuery)
|
router.POST("/query", API_RunQuery)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user