-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.go
38 lines (33 loc) · 1.04 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
package openapi
type ContentType string
const (
//Html ContentType = "text/html"
//Text ContentType = "text/plain"
//TextXml ContentType = "text/xml"
//Gif ContentType = "image/gif"
//Jpeg ContentType = "image/jpeg"
//Png ContentType = "image/png"
//AppXml ContentType = "application/xml"
Json ContentType = "application/json"
//Pdf ContentType = "application/pdf"
//Stream ContentType = "application/octet-stream"
Form ContentType = "application/x-www-form-urlencoded"
FormData ContentType = "multipart/form-data"
)
type RouteStruct interface {
GetReqPara() interface{}
GetReqBody() interface{} //interface可以为IContentType
GetResBody() map[int]interface{} //interface可以为IContentType
GetResPara() interface{}
GetDescription() string
GetPath() string
GetMethod() string
}
// IBody body返回的数据结构
type IBody interface {
Marshal() ([]byte, error)
}
// IContentType 返回的结构体在请求或返回参数的类型
type IContentType interface {
GetContentType() ContentType
}