Documentation
¶
Index ¶
- type Context
- func (c *Context) BindJSON(val any) error
- func (c *Context) BindJSONOpt(val any, useNumber bool, disableUnknown bool) error
- func (c *Context) FormValue(key string) StringValue
- func (c *Context) PathValue(key string) StringValue
- func (c *Context) QueryValue(key string) StringValue
- func (c *Context) RespJSON(status int, val any) error
- func (c *Context) RespJSONOK(val any) error
- type HTTPServer
- func (h *HTTPServer) Connect(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) Delete(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) Get(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) Head(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) Options(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) Patch(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) Post(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) Put(path string, handleFunc HandleFunc, mils ...Middleware)
- func (h *HTTPServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (h *HTTPServer) Start(addr string) error
- func (h *HTTPServer) Trace(path string, handleFunc HandleFunc, mils ...Middleware)
- func (s *HTTPServer) Use(mils ...Middleware)
- type HTTPServerOption
- type HandleFunc
- type Middleware
- type Server
- type StringValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Request *http.Request
ResponseWriter http.ResponseWriter
PathParams map[string]string
MatchedRoute string
RespData []byte
RespStatusCode int
// contains filtered or unexported fields
}
func (*Context) BindJSONOpt ¶
func (*Context) FormValue ¶
func (c *Context) FormValue(key string) StringValue
func (*Context) PathValue ¶
func (c *Context) PathValue(key string) StringValue
func (*Context) QueryValue ¶
func (c *Context) QueryValue(key string) StringValue
func (*Context) RespJSONOK ¶
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func InitHttpServer ¶
func InitHttpServer(opts ...HTTPServerOption) *HTTPServer
func (*HTTPServer) Connect ¶
func (h *HTTPServer) Connect(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Delete ¶
func (h *HTTPServer) Delete(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Get ¶
func (h *HTTPServer) Get(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Head ¶
func (h *HTTPServer) Head(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Options ¶
func (h *HTTPServer) Options(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Patch ¶
func (h *HTTPServer) Patch(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Post ¶
func (h *HTTPServer) Post(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Put ¶
func (h *HTTPServer) Put(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) ServeHTTP ¶
func (h *HTTPServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)
处理请求入口
func (*HTTPServer) Start ¶
func (h *HTTPServer) Start(addr string) error
func (*HTTPServer) Trace ¶
func (h *HTTPServer) Trace(path string, handleFunc HandleFunc, mils ...Middleware)
func (*HTTPServer) Use ¶
func (s *HTTPServer) Use(mils ...Middleware)
type HTTPServerOption ¶
type HTTPServerOption func(server *HTTPServer)
func ServerWithMiddleware ¶
func ServerWithMiddleware(mils ...Middleware) HTTPServerOption
type HandleFunc ¶
type HandleFunc func(ctx *Context)
type Middleware ¶
type Middleware func(next HandleFunc) HandleFunc
type StringValue ¶
type StringValue struct {
// contains filtered or unexported fields
}
func (*StringValue) AsFloat64 ¶
func (s *StringValue) AsFloat64() (float64, error)
func (*StringValue) AsInt64 ¶
func (s *StringValue) AsInt64() (int64, error)
func (*StringValue) AsUint64 ¶
func (s *StringValue) AsUint64() (uint64, error)
Click to show internal directories.
Click to hide internal directories.