Documentation
¶
Overview ¶
Package stdlib 提供基于标准库 net/http 的引擎实现。
Package stdlib 提供基于标准库 net/http 的引擎实现。
Index ¶
- type Context
- func (c *Context) AbortWithStatus(code int)
- func (c *Context) AbortWithStatusJSON(code int, body any)
- func (c *Context) BindJSON(target any) error
- func (c *Context) Context() context.Context
- func (c *Context) Header(key string) string
- func (c *Context) IsAborted() bool
- func (c *Context) JSON(code int, data any) error
- func (c *Context) Next()
- func (c *Context) PathParam(name string) string
- func (c *Context) Query(name string) string
- func (c *Context) QueryDefault(name, defaultVal string) string
- func (c *Context) Request() *http.Request
- func (c *Context) RequestMethod() string
- func (c *Context) RequestURI() string
- func (c *Context) SetContext(ctx context.Context)
- func (c *Context) SetHeader(key, value string)
- func (c *Context) SetStatusCode(code int)
- func (c *Context) String(code int, format string, args ...any)
- func (c *Context) WithMiddleware(mw []core.MiddlewareFunc, handler core.HandlerFunc) *Context
- func (c *Context) WithParams(params map[string]string) *Context
- type Factory
- type Router
- func (r *Router) DELETE(path string, handler core.HandlerFunc)
- func (r *Router) GET(path string, handler core.HandlerFunc)
- func (r *Router) Group(prefix string) core.Router
- func (r *Router) PATCH(path string, handler core.HandlerFunc)
- func (r *Router) POST(path string, handler core.HandlerFunc)
- func (r *Router) PUT(path string, handler core.HandlerFunc)
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Use(middleware core.MiddlewareFunc)
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context 标准库 HTTP 上下文实现。
func NewContext ¶
func NewContext(w http.ResponseWriter, r *http.Request) *Context
NewContext 创建新的 HTTP 上下文。
func (*Context) AbortWithStatusJSON ¶
AbortWithStatusJSON 中止请求并返回 JSON。
func (*Context) QueryDefault ¶
QueryDefault 获取查询参数(带默认值)。
func (*Context) WithMiddleware ¶
func (c *Context) WithMiddleware(mw []core.MiddlewareFunc, handler core.HandlerFunc) *Context
WithMiddleware 设置中间件链。
type Factory ¶
type Factory struct{}
Factory 标准库引擎工厂。
func (*Factory) CreateRouter ¶
CreateRouter 创建路由器。
func (*Factory) CreateServer ¶
CreateServer 创建服务器。
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router 标准库路由器实现。
func (*Router) DELETE ¶
func (r *Router) DELETE(path string, handler core.HandlerFunc)
DELETE 注册 DELETE 路由。
func (*Router) PATCH ¶
func (r *Router) PATCH(path string, handler core.HandlerFunc)
PATCH 注册 PATCH 路由。
Click to show internal directories.
Click to hide internal directories.