Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Err401 = NewHttpError(http.StatusUnauthorized, http.StatusUnauthorized, "身份验证失败!")
View Source
var Err403 = NewHttpError(http.StatusForbidden, http.StatusForbidden, "无权限执行该请求!")
View Source
var Err404 = NewHttpError(http.StatusNotFound, http.StatusNotFound, "请求的资源不存在!")
View Source
var ErrBodyTooLarge = NewHttpError(http.StatusOK, http.StatusRequestEntityTooLarge, "请求体过大!")
View Source
var ErrBusy = NewHttpError(http.StatusOK, http.StatusServiceUnavailable, "系统忙,请稍后再试!")
View Source
var ErrForbidden = NewHttpError(http.StatusOK, http.StatusForbidden, "无权限执行该请求!")
View Source
var ErrGoneDelete = NewHttpError(http.StatusOK, http.StatusGone, "相关记录已不存在!")
View Source
var ErrParams = NewHttpError(http.StatusOK, http.StatusBadRequest, "缺少参数或参数错误!")
View Source
var ErrRecordNotFound = NewHttpError(http.StatusOK, http.StatusNotFound, "相关记录不存在,或请稍后再试!")
View Source
var ErrServerError = NewHttpError(http.StatusOK, http.StatusInternalServerError, "系统忙,请稍后再试!")
View Source
var ErrTimeout = NewHttpError(http.StatusOK, http.StatusRequestTimeout, "请求超时,请稍后再试!")
View Source
var ErrTooManyRequests = NewHttpError(http.StatusOK, http.StatusTooManyRequests, "请求次数过多!")
View Source
var ErrUpgradeRequired = NewHttpError(http.StatusOK, http.StatusUpgradeRequired, "请升级客户端!")
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface {
rht.HttpServerContextFunc
}
type Error ¶ added in v0.0.5
type HandlerFunc ¶ added in v0.0.3
func AnyCORS ¶ added in v0.0.8
func AnyCORS(next HandlerFunc) HandlerFunc
type HandlerFuncNotErr ¶ added in v0.0.5
type HandlerFuncNotErr func(Context)
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
func (MiddlewareFunc) Append ¶ added in v0.0.3
func (m MiddlewareFunc) Append(fx MiddlewareFunc) MiddlewareFunc
type SSE ¶ added in v0.0.6
type SSE struct {
// contains filtered or unexported fields
}
func (*SSE) SendDataBytes ¶ added in v0.0.6
func (*SSE) SendDataJson ¶ added in v0.0.6
type Serve ¶
type Serve interface {
// Use 中间件
Use(fx MiddlewareFunc) Serve
// Group 分组,自动往请求路径前面增加prevPath
Group(prevPath string) Serve
// Handler 响应处理
Handler(pattern string, handler http.Handler, description ...string)
// HandleFunc 处理函数
HandleFunc(pattern string, handler HandlerFunc, description ...string)
// HandleFuncN 处理函数
HandleFuncN(pattern string, handler HandlerFuncNotErr, description ...string)
// Get 常用路由注册方法
Get(pattern string, handler HandlerFunc, description ...string)
// Post 常用路由注册方法
Post(pattern string, handler HandlerFunc, description ...string)
// Put 常用路由注册方法
Put(pattern string, handler HandlerFunc, description ...string)
// Delete 常用路由注册方法
Delete(pattern string, handler HandlerFunc, description ...string)
// Patch 常用路由注册方法
Patch(pattern string, handler HandlerFunc, description ...string)
// Options 常用路由注册方法
Options(pattern string, handler HandlerFunc, description ...string)
// Head 常用路由注册方法
Head(pattern string, handler HandlerFunc, description ...string)
// Connect 常用路由注册方法
Connect(pattern string, handler HandlerFunc, description ...string)
// Trace 常用路由注册方法
Trace(pattern string, handler HandlerFunc, description ...string)
// GetN 常用路由注册方法
GetN(pattern string, handler HandlerFuncNotErr, description ...string)
// PostN 常用路由注册方法
PostN(pattern string, handler HandlerFuncNotErr, description ...string)
// PutN 常用路由注册方法
PutN(pattern string, handler HandlerFuncNotErr, description ...string)
// DeleteN 常用路由注册方法
DeleteN(pattern string, handler HandlerFuncNotErr, description ...string)
// PatchN 常用路由注册方法
PatchN(pattern string, handler HandlerFuncNotErr, description ...string)
// OptionsN 常用路由注册方法
OptionsN(pattern string, handler HandlerFuncNotErr, description ...string)
// HeadN 常用路由注册方法
HeadN(pattern string, handler HandlerFuncNotErr, description ...string)
// ConnectN 常用路由注册方法
ConnectN(pattern string, handler HandlerFuncNotErr, description ...string)
// TraceN 常用路由注册方法
TraceN(pattern string, handler HandlerFuncNotErr, description ...string)
// ServeHTTP http服务
ServeHTTP(w http.ResponseWriter, r *http.Request)
// AllRouters 返回所有已注册的路由地址
AllRouters() []routeStrItem
}
func NewServeMux ¶
func NewServeMux() Serve
Click to show internal directories.
Click to hide internal directories.