package db_conn_storage import ( "dbview/service/internal/modules/db_conn_storage/handler" "github.com/gin-gonic/gin" ) // RegisterRoutes 注册存储相关路由 func RegisterRoutes(router *gin.Engine) { // API版本分组 v1 := router.Group("/api/v1/storage") { // 连接分组管理路由 connectionGroups := v1.Group("/connection_groups") { connectionGroups.POST("/create", handler.CreateConnectionGroup) // 创建连接分组 connectionGroups.POST("/get", handler.GetConnectionGroup) // 获取指定连接分组 connectionGroups.POST("/update", handler.UpdateConnectionGroup) // 更新连接分组 connectionGroups.POST("/delete", handler.DeleteConnectionGroup) // 删除连接分组 connectionGroups.POST("/move", handler.MoveConnectionGroup) // 移动连接分组 connectionGroups.POST("/tree", handler.GetConnectionGroupTree) // 获取连接分组树 } // 连接管理路由 connections := v1.Group("/connections") { connections.POST("/create", handler.CreateConnection) // 创建连接 connections.POST("/get", handler.GetConnection) // 获取指定连接 connections.POST("/update", handler.UpdateConnection) // 更新连接 connections.POST("/delete", handler.DeleteConnection) // 删除连接 connections.POST("/move", handler.MoveConnection) // 移动连接 connections.POST("/list", handler.GetAllConnections) // 获取所有连接 } // 脚本分组管理路由 scriptGroups := v1.Group("/script_groups") { scriptGroups.POST("/create", handler.CreateScriptGroup) // 创建脚本分组 scriptGroups.POST("/get", handler.GetScriptGroup) // 获取指定脚本分组 scriptGroups.POST("/update", handler.UpdateScriptGroup) // 更新脚本分组 scriptGroups.POST("/delete", handler.DeleteScriptGroup) // 删除脚本分组 scriptGroups.POST("/move", handler.MoveScriptGroup) // 移动脚本分组 scriptGroups.POST("/tree", handler.GetScriptGroupTree) // 获取脚本分组树 } // SQL脚本管理路由 scripts := v1.Group("/scripts") { scripts.POST("/create", handler.CreateScript) // 创建脚本 scripts.POST("/get", handler.GetScript) // 获取指定脚本 scripts.POST("/update", handler.UpdateScript) // 更新脚本 scripts.POST("/delete", handler.DeleteScript) // 删除脚本 scripts.POST("/list_by_connection", handler.ListScripts) // 获取指定连接的所有脚本 scripts.POST("/update_stats", handler.UpdateScriptExecutionStats) // 更新脚本执行统计 } } }