-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.go
81 lines (62 loc) · 1.14 KB
/
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
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
package ginx
import (
"context"
"github.com/gin-gonic/gin"
)
type Operator interface {
Output(ctx *gin.Context) (interface{}, error)
}
type PathDescriber interface {
Path() string
}
type BasePathDescriber interface {
BasePath() string
}
type MethodDescriber interface {
Method() string
}
type StatusCodeDescriber interface {
StatusCode() int
}
type TypeDescriber interface {
Type() string
}
type ContentTypeDescriber interface {
ContentType() string
}
type MineDescriber interface {
ContentTypeDescriber
Bytes() []byte
}
type Header interface {
Header(ctx *gin.Context)
}
type Invoker interface {
Invoke(ctx context.Context, req interface{}) (Response, error)
}
type Response interface {
Bind(interface{}) error
}
type Request interface {
PathDescriber
MethodDescriber
}
type HandleOperator interface {
Operator
Request
}
type TypeOperator interface {
Operator
TypeDescriber
}
type RouterOperator interface {
Operator
Request
BasePathDescriber
}
type GroupOperator interface {
Operator
BasePathDescriber
}
type EmptyOperator struct{}
func (e *EmptyOperator) Output(ctx *gin.Context) (interface{}, error) { return nil, nil }