Files
新亮 4c37a7e6b5 feature(1.2.8): swagger 接口文档新增 Security
- 将 middleware 命名为 interceptor
- 将 deploy 命名为 deployments
- 移除 pkg/errno
- 使用 proposal 目录
- 优化代码
2021-11-28 13:25:27 +08:00

39 lines
828 B
Go

package tool
import (
"github.com/xinliangnote/go-gin-api/configs"
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
)
type dbsResponse struct {
List []dbData `json:"list"` // 数据库列表
}
type dbData struct {
DbName string `json:"db_name"` // 数据库名称
}
// Dbs 查询 DB
// @Summary 查询 DB
// @Description 查询 DB
// @Tags API.tool
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {object} dbsResponse
// @Failure 400 {object} code.Failure
// @Router /api/tool/data/dbs [get]
// @Security LoginToken
func (h *handler) Dbs() core.HandlerFunc {
return func(c core.Context) {
res := new(dbsResponse)
// TODO 后期支持查询多个数据库
data := dbData{
DbName: configs.Get().MySQL.Read.Name,
}
res.List = append(res.List, data)
c.Payload(res)
}
}