chore: change App to Engine
This commit is contained in:
parent
388a2c57e1
commit
ccd6289c9c
@ -31,20 +31,20 @@ type Context struct {
|
||||
User IUser
|
||||
}
|
||||
|
||||
type App struct {
|
||||
type Engine struct {
|
||||
*gin.Engine
|
||||
}
|
||||
type Router struct {
|
||||
*gin.RouterGroup
|
||||
}
|
||||
|
||||
func New() *App {
|
||||
return &App{
|
||||
func New() *Engine {
|
||||
return &Engine{
|
||||
Engine: gin.New(),
|
||||
}
|
||||
}
|
||||
func Default() *App {
|
||||
return &App{
|
||||
func Default() *Engine {
|
||||
return &Engine{
|
||||
Engine: gin.Default(),
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ func handleFunc(hd func(c *Context)) func(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// 重写路由组注册
|
||||
func (app *App) Group(relativePath string, handlers ...HandleFunc) *Router {
|
||||
func (app *Engine) Group(relativePath string, handlers ...HandleFunc) *Router {
|
||||
hds := make([]gin.HandlerFunc, 0)
|
||||
for _, hd := range handlers {
|
||||
hds = append(hds, handleFunc(hd))
|
||||
@ -71,7 +71,7 @@ func (app *App) Group(relativePath string, handlers ...HandleFunc) *Router {
|
||||
}
|
||||
|
||||
// 重写根GET请求
|
||||
func (app *App) GET(relativePath string, handlers ...HandleFunc) gin.IRoutes {
|
||||
func (app *Engine) GET(relativePath string, handlers ...HandleFunc) gin.IRoutes {
|
||||
hds := make([]gin.HandlerFunc, 0)
|
||||
for _, hd := range handlers {
|
||||
hds = append(hds, handleFunc(hd))
|
||||
@ -80,7 +80,7 @@ func (app *App) GET(relativePath string, handlers ...HandleFunc) gin.IRoutes {
|
||||
}
|
||||
|
||||
// 重写根POST请求
|
||||
func (app *App) POST(relativePath string, handlers ...HandleFunc) gin.IRoutes {
|
||||
func (app *Engine) POST(relativePath string, handlers ...HandleFunc) gin.IRoutes {
|
||||
hds := make([]gin.HandlerFunc, 0)
|
||||
for _, hd := range handlers {
|
||||
hds = append(hds, handleFunc(hd))
|
||||
|
@ -9,7 +9,7 @@ package gweb
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type Engine = gin.Engine
|
||||
// type Engine = gin.Engine
|
||||
type H = gin.H
|
||||
type HandlersChain = gin.HandlersChain
|
||||
type RouteInfo = gin.RouteInfo
|
||||
|
Loading…
Reference in New Issue
Block a user