Files
go-gin-api/internal/api/tool/func_dbs.go
2021-11-21 13:23:27 +08:00

38 lines
790 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 multipart/form-data
// @Produce json
// @Success 200 {object} dbsResponse
// @Failure 400 {object} code.Failure
// @Router /api/tool/data/dbs [get]
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)
}
}