Documentation
¶
Index ¶
- Constants
- func MakeCookie(userID int, co CookieOption) (cookie http.Cookie, err error)
- func SetResultVersion(ver int)
- type AddResult
- type Checker
- type Content
- type CookieOption
- type File
- type Filter
- type Group
- type HandlerFunc
- type Limiter
- type Method
- type Newer
- type Option
- type Param
- type RegisterOption
- type Result
- type Result1
- type ResultCode
- type Router
Constants ¶
View Source
const ( ContentDispositionHeaderKey = "Content-Disposition" ContentDispositionHeaderValueFormat = `attachment; filename="%s"` )
header相关
Variables ¶
This section is empty.
Functions ¶
func MakeCookie ¶
func MakeCookie(userID int, co CookieOption) (cookie http.Cookie, err error)
MakeCookie 新建令牌
func SetResultVersion ¶ added in v0.7.0
func SetResultVersion(ver int)
Types ¶
type Content ¶
type Content struct {
ContentLength int64 `json:"-"`
ContentType string `json:"-"`
ContentReader io.Reader `json:"-"`
ExtraHeaders map[string]string `json:"-"`
}
Content 内容
func MakeContentFromBuffer ¶
MakeContentFromBuffer 新建内容
type CookieOption ¶
type HandlerFunc ¶
HandlerFunc 处理函数 使用别名,可以互相替换,但是不能添加方法 使用类型,不可以互相替换,需要转型,但是可以添加方法
type RegisterOption ¶
type Result ¶
type Result struct {
utilerrors.Error
Data interface{} `json:"data"` // 正常返回时的数据
// 给登陆接口使用
CookieAfterLogin int `json:"-"` // 登陆时需要设置登陆态的用户信息
// 时间戳
Timestamp int64 `json:"timestamp"`
// 请求ID,在请求到来时生成,处理过程传递,返回时一并返回
RequestID string `json:"requestID"` // uuid
// 下载内容时使用
Content
}
Result 结果
func (Result) MarshalJSON ¶ added in v0.7.0
func (*Result) PresentData ¶
PresentData 用具体结构体展现数据
type Result1 ¶ added in v0.7.0
type Result1 struct {
Header ResultCode `json:"header"`
Data interface{} `json:"data"` // 可以是对象或数组
}
type ResultCode ¶ added in v0.7.0
Click to show internal directories.
Click to hide internal directories.