Documentation ¶
Index ¶
- Constants
- Variables
- func MakeCookie(userID int, co CookieOption) (cookie http.Cookie, err error)
- func RegisterProxyMethod(pctx inject.ProxyContext, cf inject.CtxFunc)
- func SetResultVersion(ver int)
- type AddResult
- type Checker
- type CheckerMock
- type Content
- type CookieOption
- type File
- type Filter
- type FilterMock
- type Group
- type HandlerFunc
- type Limiter
- type Method
- type Newer
- type NewerMock
- 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 ¶
View Source
var (
CheckerMockCheckProxyContext = func() (pctx inject.ProxyContext) {
pctx = checkerMockCommonProxyContext
pctx.MethodName = "Check"
return
}()
)
View Source
var (
FilterMockFilterProxyContext = func() (pctx inject.ProxyContext) {
pctx = filterMockCommonProxyContext
pctx.MethodName = "Filter"
return
}()
)
View Source
var (
NewerMockNewProxyContext = func() (pctx inject.ProxyContext) {
pctx = newerMockCommonProxyContext
pctx.MethodName = "New"
return
}()
)
Functions ¶
func MakeCookie ¶
func MakeCookie(userID int, co CookieOption) (cookie http.Cookie, err error)
MakeCookie 新建令牌
func RegisterProxyMethod ¶ added in v0.12.0
func RegisterProxyMethod(pctx inject.ProxyContext, cf inject.CtxFunc)
func SetResultVersion ¶ added in v0.7.0
func SetResultVersion(ver int)
Types ¶
type CheckerMock ¶ added in v0.12.0
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 FilterMock ¶ added in v0.12.0
type FilterMock struct {
FilterFunc func() any
}
func (*FilterMock) Filter ¶ added in v0.12.0
func (mockRecv *FilterMock) Filter() any
type HandlerFunc ¶
HandlerFunc 处理函数 使用别名,可以互相替换,但是不能添加方法 使用类型,不可以互相替换,需要转型,但是可以添加方法
type RegisterOption ¶
type Result ¶
type Result struct { utilerrors.Error Data any `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
type Result1 ¶ added in v0.7.0
type Result1 struct { Header ResultCode `json:"header"` Data any `json:"data"` // 可以是对象或数组 }
type ResultCode ¶ added in v0.7.0
Click to show internal directories.
Click to hide internal directories.