-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
101 lines (80 loc) · 2.98 KB
/
config.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package logger
import (
"context"
"github.com/gin-gonic/gin"
"github.com/gofiber/fiber/v2"
"github.com/labstack/echo/v4"
"google.golang.org/grpc"
)
// ConfigEcho defines a function which is executed just before the middleware.
type ConfigEcho struct {
// SkipperEcho defines a function to skip middleware.
SkipperEcho SkipperEcho
// BeforeFunc defines a function which is executed just before the middleware.
BeforeFuncEcho BeforeFuncEcho
}
type (
// SkipperEcho defines a function to skip middleware. Returning true skips processing
// the middleware.
SkipperEcho func(echo.Context) bool
// BeforeFuncEcho defines a function which is executed just before the middleware.
BeforeFuncEcho func(echo.Context)
)
// DefaultSkipperEcho returns false which processes the middleware.
func DefaultSkipperEcho(echo.Context) bool {
return false
}
// ConfigGin defines a function which is executed just before the middleware.
type ConfigGin struct {
// SkipperGin defines a function to skip middleware.
SkipperGin SkipperGin
// BeforeFunc defines a function which is executed just before the middleware.
BeforeFuncGin BeforeFuncGin
}
type (
// SkipperGin defines a function to skip middleware. Returning true skips processing
// the middleware.
SkipperGin func(*gin.Context) bool
// BeforeFuncGin defines a function which is executed just before the middleware.
BeforeFuncGin func(*gin.Context)
)
// DefaultSkipperGin returns false which processes the middleware.
func DefaultSkipperGin(*gin.Context) bool {
return false
}
// ConfigFiber defines a function which is executed just before the middleware.
type ConfigFiber struct {
// SkipperFiber defines a function to skip middleware.
SkipperFiber SkipperFiber
// BeforeFunc defines a function which is executed just before the middleware.
BeforeFuncFiber BeforeFuncFiber
}
type (
// SkipperFiber defines a function to skip middleware. Returning true skips processing
// the middleware.
SkipperFiber func(ctx *fiber.Ctx) bool
// BeforeFuncFiber defines a function which is executed just before the middleware.
BeforeFuncFiber func(ctx *fiber.Ctx)
)
// DefaultSkipperFiber returns false which processes the middleware.
func DefaultSkipperFiber(ctx *fiber.Ctx) bool {
return false
}
// ConfigGrpc defines a function which is executed just before the middleware.
type ConfigGrpc struct {
// SkipperGrpc defines a function to skip middleware.
SkipperGrpc SkipperGrpc
// BeforeFunc defines a function which is executed just before the middleware.
BeforeFuncGrpc BeforeFuncGrpc
}
type (
// SkipperGrpc defines a function to skip middleware. Returning true skips processing
// the middleware.
SkipperGrpc func(context.Context, *grpc.UnaryServerInfo) bool
// BeforeFuncGrpc defines a function which is executed just before the middleware.
BeforeFuncGrpc func(context.Context, *grpc.UnaryServerInfo)
)
// DefaultSkipperGrpc returns false which processes the middleware.
func DefaultSkipperGrpc(context.Context, *grpc.UnaryServerInfo) bool {
return false
}