feat: 新增数据库表信息查看及其他优化

This commit is contained in:
meilin.huang
2021-08-18 17:57:33 +08:00
parent 5f1b74aba1
commit 00f053573e
57 changed files with 421 additions and 523 deletions

View File

@@ -48,6 +48,22 @@ func (d *Db) DeleteDb(rc *ctx.ReqCtx) {
d.DbApp.Delete(uint64(ginx.PathParamInt(rc.GinCtx, "id")))
}
func (d *Db) TableInfos(rc *ctx.ReqCtx) {
rc.ResData = d.DbApp.GetDbInstance(GetDbId(rc.GinCtx)).GetTableInfos()
}
func (d *Db) TableIndex(rc *ctx.ReqCtx) {
tn := rc.GinCtx.Query("tableName")
biz.NotEmpty(tn, "tableName不能为空")
rc.ResData = d.DbApp.GetDbInstance(GetDbId(rc.GinCtx)).GetTableIndex(tn)
}
func (d *Db) GetCreateTableDdl(rc *ctx.ReqCtx) {
tn := rc.GinCtx.Query("tableName")
biz.NotEmpty(tn, "tableName不能为空")
rc.ResData = d.DbApp.GetDbInstance(GetDbId(rc.GinCtx)).GetCreateTableDdl(tn)
}
// @router /api/db/:dbId/exec-sql [get]
func (d *Db) ExecSql(rc *ctx.ReqCtx) {
g := rc.GinCtx
@@ -84,7 +100,6 @@ func (d *Db) ExecSql(rc *ctx.ReqCtx) {
rc.ResData = colAndRes
}
}
// @router /api/db/:dbId/t-metadata [get]