Documentation
¶
Index ¶
- func SetMaxMultipartMemory(size int64)
- type Context
- func (own *Context) GetFormFile(filename string) (multipart.File, *multipart.FileHeader, error)
- func (own *Context) GetFormValue(key string) string
- func (own *Context) GetHeader(key string) string
- func (own *Context) GetHost() string
- func (own *Context) GetMethod() string
- func (own *Context) GetMultipartFormValue(key string) string
- func (own *Context) GetPathValue(name string) string
- func (own *Context) GetPostFormValue(key string) string
- func (own *Context) GetProtocol() string
- func (own *Context) GetRequest() *http.Request
- func (own *Context) GetResponse() http.ResponseWriter
- func (own *Context) GetSeriveName() string
- func (own *Context) GetURL() *url.URL
- func (own *Context) QueryPageAndLimit() (page, limit int, err error)
- func (own *Context) QueryValue(key string) string
- func (own *Context) ReadJson(data any) error
- func (own *Context) ResponseBytes(code int, data []byte) error
- func (own *Context) ResponseFail(code int, error string)
- func (own *Context) ResponseFile(filename string) error
- func (own *Context) ResponseFileContent(filename string) error
- func (own *Context) ResponseHTML(filename, tmplname string, data any) error
- func (own *Context) ResponseJSON(code int, data any) error
- func (own *Context) ResponseSSE(sse func() <-chan []byte) (err error)
- func (own *Context) ResponseString(code int, data string) error
- func (own *Context) ResponseUpgrade(upgrade func(conn net.Conn)) error
- func (own *Context) SetHeader(key, value string)
- func (own *Context) WithContext(ctx context.Context) *Context
- func (own *Context) WriteCode(code int)
- type Engine
- func (own Engine) DELETE(part string, handle HandleFunc, name ...string)
- func (own Engine) GET(part string, handle HandleFunc, name ...string)
- func (own *Engine) GetServiceName() string
- func (own Engine) Group(prefix string) *group
- func (own *Engine) ListenAndServe(opts *Options)
- func (own *Engine) ListenAndServeTLS(opts *Options)
- func (own Engine) POST(part string, handle HandleFunc, name ...string)
- func (own Engine) PUT(part string, handle HandleFunc, name ...string)
- func (own *Engine) WithInterceptors(interceptors ...Interceptor) *Engine
- func (own Engine) WithMiddlewares(middlewares ...MiddlewareFunc) *group
- func (own Engine) WithStatics(relativePath string, root string, name ...string) *group
- type HandleFunc
- type Handler
- type Interceptor
- type Json
- type MiddlewareFunc
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetMaxMultipartMemory ¶
func SetMaxMultipartMemory(size int64)
Types ¶
type Context ¶
type Context struct { StatusCode int // contains filtered or unexported fields }
Context 定义上下文的结构
func (*Context) GetFormFile ¶
func (*Context) GetFormValue ¶
func (*Context) GetMultipartFormValue ¶
func (*Context) GetPathValue ¶
func (*Context) GetPostFormValue ¶
func (*Context) GetProtocol ¶
func (*Context) GetRequest ¶
func (*Context) GetResponse ¶
func (own *Context) GetResponse() http.ResponseWriter
func (*Context) GetSeriveName ¶
func (*Context) QueryPageAndLimit ¶
func (*Context) QueryValue ¶
func (*Context) ResponseFail ¶
func (*Context) ResponseFile ¶
func (*Context) ResponseFileContent ¶
func (*Context) ResponseHTML ¶
func (*Context) ResponseSSE ¶
func (*Context) ResponseUpgrade ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine 定义引擎的结构
func NewDefaultEngine ¶
func (Engine) DELETE ¶
func (own Engine) DELETE(part string, handle HandleFunc, name ...string)
DELETE 给当前路由组添加一个处理 DELETE 方法的处理器
func (Engine) GET ¶
func (own Engine) GET(part string, handle HandleFunc, name ...string)
GET 给当前路由组添加一个处理 GET 方法的处理器
func (*Engine) GetServiceName ¶
func (*Engine) ListenAndServe ¶
ListenAndServe 启动一个 HTTP 服务
func (*Engine) ListenAndServeTLS ¶
ListenAndServeTLS 启动一个 HTTPS 服务
func (Engine) POST ¶
func (own Engine) POST(part string, handle HandleFunc, name ...string)
POST 给当前路由组添加一个处理 POST 方法的处理器
func (Engine) PUT ¶
func (own Engine) PUT(part string, handle HandleFunc, name ...string)
PUT 给当前路由组添加一个处理 PUT 方法的处理器
func (*Engine) WithInterceptors ¶
func (own *Engine) WithInterceptors(interceptors ...Interceptor) *Engine
func (Engine) WithMiddlewares ¶
func (own Engine) WithMiddlewares(middlewares ...MiddlewareFunc) *group
WithMiddlewares 给当前路由组添加中间件
func (Engine) WithStatics ¶
WithStatics 给当前路由组添加静态文件服务接口
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler 定义处理器的结构
func (*Handler) ServeHTTP ¶
func (own *Handler) ServeHTTP(resp http.ResponseWriter, req *http.Request)
ServeHTTP 实现 http.Handler 接口
func (*Handler) WithMiddlewares ¶
func (own *Handler) WithMiddlewares(middlewares ...MiddlewareFunc) *Handler
WithMiddlewares 给处理器添加中间件
type Interceptor ¶
type MiddlewareFunc ¶
type MiddlewareFunc func(HandleFunc) HandleFunc
MiddlewareFunc 定义处理器中间件函数的类型
func AuthFromHubuByHTTP ¶
func AuthFromHubuByHTTP(method, url string) MiddlewareFunc
AuthFromHubuByHTTP 通过 HTTP 协议到 Hubu 进行接口请求鉴权,请求头需要携带 Hubu-User-Id
func AuthFromHubuByRPC ¶
func AuthFromHubuByRPC(host string) MiddlewareFunc
AuthFromHubuByRPC 通过 RPC(gob) 协议到 Hubu 进行接口请求鉴权,请求头需要携带 Hubu-User-Id
Source Files
¶
Click to show internal directories.
Click to hide internal directories.