-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgin_interface.go
47 lines (34 loc) · 976 Bytes
/
gin_interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package gone
import "github.com/gin-gonic/gin"
// Context is a wrapper of gin.Context
type Context struct {
*gin.Context
}
type ResponseWriter = gin.ResponseWriter
type HandlerFunc any
type IRoutes interface {
Use(...HandlerFunc) IRoutes
Handle(string, string, ...HandlerFunc) IRoutes
Any(string, ...HandlerFunc) IRoutes
GET(string, ...HandlerFunc) IRoutes
POST(string, ...HandlerFunc) IRoutes
DELETE(string, ...HandlerFunc) IRoutes
PATCH(string, ...HandlerFunc) IRoutes
PUT(string, ...HandlerFunc) IRoutes
OPTIONS(string, ...HandlerFunc) IRoutes
HEAD(string, ...HandlerFunc) IRoutes
}
type IRouter interface {
IRoutes
GetGinRouter() gin.IRouter
Group(string, ...HandlerFunc) RouteGroup
LoadHTMLGlob(pattern string)
}
// RouteGroup route group, which is a wrapper of gin.RouterGroup, and can be injected for mount router.
type RouteGroup interface {
IRouter
}
type GinMiddleware interface {
Process(ctx *Context) error
}
type GinMountError error