You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
553 B
Go
33 lines
553 B
Go
package router
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
ctxpkg "github.com/noahlann/nnet/pkg/context"
|
|
)
|
|
|
|
// Handler 处理器函数
|
|
type Handler func(ctx ctxpkg.Context) error
|
|
|
|
// Handlers 处理器链
|
|
type Handlers []Handler
|
|
|
|
// Route 路由接口
|
|
type Route interface {
|
|
// Use 添加中间件
|
|
Use(middleware ...Handler) Route
|
|
|
|
// Handler 获取处理器
|
|
Handler() Handler
|
|
|
|
// RequestType 获取请求类型
|
|
RequestType() reflect.Type
|
|
|
|
// ResponseType 获取响应类型
|
|
ResponseType() reflect.Type
|
|
|
|
// CodecName 获取编解码器名称
|
|
CodecName() string
|
|
}
|
|
|