routes.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package db_conn_storage
  2. import (
  3. "dbview/service/internal/modules/db_conn_storage/handler"
  4. "github.com/gin-gonic/gin"
  5. )
  6. // RegisterRoutes 注册存储相关路由
  7. func RegisterRoutes(router *gin.Engine) {
  8. // API版本分组
  9. v1 := router.Group("/api/v1/storage")
  10. {
  11. // 连接分组管理路由
  12. connectionGroups := v1.Group("/connection_groups")
  13. {
  14. connectionGroups.POST("/create", handler.CreateConnectionGroup) // 创建连接分组
  15. connectionGroups.POST("/get", handler.GetConnectionGroup) // 获取指定连接分组
  16. connectionGroups.POST("/update", handler.UpdateConnectionGroup) // 更新连接分组
  17. connectionGroups.POST("/delete", handler.DeleteConnectionGroup) // 删除连接分组
  18. connectionGroups.POST("/move", handler.MoveConnectionGroup) // 移动连接分组
  19. connectionGroups.POST("/tree", handler.GetConnectionGroupTree) // 获取连接分组树
  20. }
  21. // 连接管理路由
  22. connections := v1.Group("/connections")
  23. {
  24. connections.POST("/create", handler.CreateConnection) // 创建连接
  25. connections.POST("/get", handler.GetConnection) // 获取指定连接
  26. connections.POST("/update", handler.UpdateConnection) // 更新连接
  27. connections.POST("/delete", handler.DeleteConnection) // 删除连接
  28. connections.POST("/move", handler.MoveConnection) // 移动连接
  29. connections.POST("/list", handler.GetAllConnections) // 获取所有连接
  30. }
  31. // 脚本分组管理路由
  32. scriptGroups := v1.Group("/script_groups")
  33. {
  34. scriptGroups.POST("/create", handler.CreateScriptGroup) // 创建脚本分组
  35. scriptGroups.POST("/get", handler.GetScriptGroup) // 获取指定脚本分组
  36. scriptGroups.POST("/update", handler.UpdateScriptGroup) // 更新脚本分组
  37. scriptGroups.POST("/delete", handler.DeleteScriptGroup) // 删除脚本分组
  38. scriptGroups.POST("/move", handler.MoveScriptGroup) // 移动脚本分组
  39. scriptGroups.POST("/tree", handler.GetScriptGroupTree) // 获取脚本分组树
  40. }
  41. // SQL脚本管理路由
  42. scripts := v1.Group("/scripts")
  43. {
  44. scripts.POST("/create", handler.CreateScript) // 创建脚本
  45. scripts.POST("/get", handler.GetScript) // 获取指定脚本
  46. scripts.POST("/update", handler.UpdateScript) // 更新脚本
  47. scripts.POST("/delete", handler.DeleteScript) // 删除脚本
  48. scripts.POST("/list_by_connection", handler.ListScripts) // 获取指定连接的所有脚本
  49. scripts.POST("/update_stats", handler.UpdateScriptExecutionStats) // 更新脚本执行统计
  50. }
  51. }
  52. }