routes.go 698 B

1234567891011121314151617181920212223
  1. package connection_pool
  2. import (
  3. "dbview/service/internal/common/manager/connection"
  4. "dbview/service/internal/modules/connection_pool/handler"
  5. "dbview/service/internal/modules/connection_pool/service"
  6. "github.com/gin-gonic/gin"
  7. )
  8. // RegisterRoutes 注册连接池管理相关路由
  9. func RegisterRoutes(engine *gin.Engine, pool *connection.ConnectionPool) {
  10. service.Init(pool)
  11. group := engine.Group("/api/v1/connection_pool")
  12. {
  13. group.POST("/register", handler.RegisterConnection)
  14. group.POST("/stats", handler.GetConnectionStats)
  15. group.POST("/close", handler.CloseConnection)
  16. group.POST("/close_all", handler.CloseAllConnections)
  17. group.POST("/ping", handler.PingConnection)
  18. }
  19. }