| 123456789101112131415161718 |
- package routes
-
- import (
- "database/sql"
-
- "github.com/gin-gonic/gin"
-
- "git.x2erp.com/qdy/go-base/types"
- "git.x2erp.com/qdy/go-db/factory"
- )
-
- // 创建带 db 的 handler
- func QueryHandler(db *sql.DB) func(c *gin.Context, req types.QueryRequest) {
- return func(c *gin.Context, req types.QueryRequest) {
- result := factory.QueryToJSON(db, req.SQL)
- c.JSON(200, result)
- }
- }
|