mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
feature: 实现数据库实例管理
This commit is contained in:
32
server/internal/db/router/instance.go
Normal file
32
server/internal/db/router/instance.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"mayfly-go/internal/db/api"
|
||||
"mayfly-go/internal/db/application"
|
||||
msgapp "mayfly-go/internal/msg/application"
|
||||
"mayfly-go/pkg/req"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitInstanceRouter(router *gin.RouterGroup) {
|
||||
instances := router.Group("/instances")
|
||||
|
||||
d := &api.Instance{
|
||||
InstanceApp: application.GetInstanceApp(),
|
||||
MsgApp: msgapp.GetMsgApp(),
|
||||
}
|
||||
|
||||
reqs := [...]*req.Conf{
|
||||
// 获取数据库列表
|
||||
req.NewGet("", d.Instances),
|
||||
|
||||
req.NewPost("", d.SaveInstance).Log(req.NewLogSave("db-保存数据库实例信息")),
|
||||
|
||||
req.NewGet(":dbId/pwd", d.GetInstancePwd),
|
||||
|
||||
req.NewDelete(":dbId", d.DeleteInstance).Log(req.NewLogSave("db-删除数据库实例")),
|
||||
}
|
||||
|
||||
req.BatchSetGroup(instances, reqs[:])
|
||||
}
|
||||
Reference in New Issue
Block a user