| 12345678910111213141516171819202122232425262728293031 |
- package routes
-
- import (
- "time"
-
- "github.com/gin-gonic/gin"
-
- "git.x2erp.com/qdy/go-base/types"
- "git.x2erp.com/qdy/go-db/factory"
- )
-
- // InfoHandler 数据库信息
- func InfoHandler(dbFactory *factory.DBFactory) gin.HandlerFunc {
- return func(c *gin.Context) {
- config := dbFactory.GetConfig()
- drivers := dbFactory.GetAvailableDrivers()
-
- c.JSON(200, &types.QueryResult{
- Success: true,
- Data: map[string]interface{}{
- "database_type": config.GetDatabase().Type,
- "database_host": config.GetDatabase().Host,
- "database_port": config.GetDatabase().Port,
- "database_name": config.GetDatabase().Database,
- "available_drivers": drivers,
- "service_time": time.Now().Format(time.RFC3339),
- },
- Error: "",
- })
- }
- }
|