Documentation ¶
Index ¶
- type AfterFunction
- type BeforeFunction
- type Endpoint
- type ErrorFunction
- type FinalizerFunction
- type GRPCAfterFunction
- type GRPCBeforeFunction
- type GRPCFinalizerFunction
- type GRPCHandler
- type GRPCHandlerOption
- type GRPCRequestFunction
- type GRPCResponseFunction
- type Handler
- type HandlerOption
- type Middleware
- type PanicHandler
- type RequestFunction
- type ResponseFunction
- type Router
- func (r *Router) DELETE(path string, handler http.Handler)
- func (r *Router) GET(path string, handler http.Handler)
- func (r *Router) HEAD(path string, handle http.Handler)
- func (r *Router) Handler(method, path string, handler http.Handler)
- func (r *Router) HandlerFunc(method, path string, handler http.HandlerFunc)
- func (r *Router) OPTIONS(path string, handle http.Handler)
- func (r *Router) PATCH(path string, handler http.Handler)
- func (r *Router) POST(path string, handler http.Handler)
- func (r *Router) PUT(path string, handler http.Handler)
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterFunction ¶
AfterFunction 请求后方法,请求后处理
type BeforeFunction ¶
BeforeFunction 请求前方法,请求前处理
type ErrorFunction ¶
type ErrorFunction func(ctx context.Context, w http.ResponseWriter, err error)
ErrorFunction 错误方法,错误信息
type FinalizerFunction ¶ added in v0.0.6
FinalizerFunction 终结方法,请求响应数据解析
type GRPCAfterFunction ¶ added in v0.0.4
type GRPCAfterFunction func(ctx context.Context, header *metadata.MD, trailer *metadata.MD) (retCtx context.Context)
GRPCAfterFunction 请求后方法,请求后处理
type GRPCBeforeFunction ¶ added in v0.0.4
GRPCBeforeFunction 请求前方法,请求前处理
type GRPCFinalizerFunction ¶ added in v0.0.6
GRPCFinalizerFunction 终结方法,请求响应数据解析
type GRPCHandler ¶ added in v0.0.4
type GRPCHandler struct {
// contains filtered or unexported fields
}
GRPCHandler 处理器
func NewGRPCHandler ¶ added in v0.0.4
func NewGRPCHandler(endpoint Endpoint, request GRPCRequestFunction, response GRPCResponseFunction, option ...GRPCHandlerOption) (handler *GRPCHandler)
NewGRPCHandler 新建处理器
type GRPCHandlerOption ¶ added in v0.0.4
type GRPCHandlerOption func(handler *GRPCHandler)
GRPCHandlerOption 处理器操作
func GRPCAfterOption ¶ added in v0.0.4
func GRPCAfterOption(after ...GRPCAfterFunction) (handler GRPCHandlerOption)
GRPCAfterOption 处理后操作
func GRPCBeforeOption ¶ added in v0.0.4
func GRPCBeforeOption(before ...GRPCBeforeFunction) (handler GRPCHandlerOption)
GRPCBeforeOption 处理前操作
func GRPCFinalizerOption ¶ added in v0.0.6
func GRPCFinalizerOption(finalizer ...GRPCFinalizerFunction) (handler GRPCHandlerOption)
GRPCFinalizerOption 终结操作
type GRPCRequestFunction ¶ added in v0.0.4
GRPCRequestFunction 请求方法,请求数据解析
type GRPCResponseFunction ¶ added in v0.0.4
type GRPCResponseFunction func(ctx context.Context, w interface{}) (response interface{}, err error)
GRPCResponseFunction 响应方法,响应数据解析
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler 处理器
func NewHandler ¶
func NewHandler(endpoint Endpoint, request RequestFunction, response ResponseFunction, option ...HandlerOption) (handler *Handler)
NewHandler 新建处理器
type HandlerOption ¶
type HandlerOption func(handler *Handler)
HandlerOption 处理器操作
func AfterOption ¶
func AfterOption(after ...AfterFunction) (handler HandlerOption)
AfterOption 处理后操作
func BeforeOption ¶
func BeforeOption(before ...BeforeFunction) (handler HandlerOption)
BeforeOption 处理前操作
func FinalizerOption ¶ added in v0.0.6
func FinalizerOption(finalizer ...FinalizerFunction) (handler HandlerOption)
FinalizerOption 终结操作
type Middleware ¶
Middleware 中间件,端点中间件调用
type PanicHandler ¶ added in v0.0.6
type PanicHandler func(w http.ResponseWriter, r *http.Request, err interface{})
PanicHandler 错误处理器
type RequestFunction ¶
RequestFunction 请求方法,请求数据解析
type ResponseFunction ¶
type ResponseFunction func(ctx context.Context, w http.ResponseWriter, response interface{}) (err error)
ResponseFunction 响应方法,响应数据解析
type Router ¶
type Router struct { NotFound http.Handler // 未找到处理器 PanicHandler PanicHandler // 错误处理器 // contains filtered or unexported fields }
Router 路由器
func (*Router) HandlerFunc ¶ added in v0.0.3
func (r *Router) HandlerFunc(method, path string, handler http.HandlerFunc)
HandlerFunc 处理器