Documentation ¶
Index ¶
- func AddController(v interface{})
- func AddInterceptor(interceptor interceptor.Interceptor, order int)
- func Register(controller *RestfulController)
- type BeforeDispatchCallbackFunc
- type CommonResponse
- type Config
- type HttpMetric
- type HttpServer
- func (s *HttpServer) AddController(v interface{})
- func (s *HttpServer) AddInterceptor(i interceptor.Interceptor, order int)
- func (s *HttpServer) Close()
- func (s *HttpServer) Register(controller *RestfulController)
- func (s *HttpServer) SetBeforeDispatchCallBack(callbackFunc BeforeDispatchCallbackFunc)
- func (s *HttpServer) StartUp()
- type RequestCtx
- type RestfulController
- func (c *RestfulController) Action(action string) *RestfulController
- func (c *RestfulController) Controller(controllerName string) *RestfulController
- func (c *RestfulController) GetPath() string
- func (c *RestfulController) GetVersion() string
- func (c *RestfulController) Method(method string) *RestfulController
- func (c *RestfulController) Path(path string) *RestfulController
- func (c *RestfulController) Version(version string) *RestfulController
- type ValidFunc
- type WebLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddController ¶
func AddController(v interface{})
func AddInterceptor ¶
func AddInterceptor(interceptor interceptor.Interceptor, order int)
func Register ¶
func Register(controller *RestfulController)
Types ¶
type BeforeDispatchCallbackFunc ¶
type BeforeDispatchCallbackFunc func(w http.ResponseWriter, r *http.Request) bool
BeforeDispatchCallbackFunc 在进行分发前进行回调的函数, 返回true结束
type CommonResponse ¶
type Config ¶
type Config struct { Name string `yaml:"name" default:"default"` Port int `yaml:"port" default:"8080"` ReadTimeout int `yaml:"read_timeout" default:"10"` WriteTimeout int `yaml:"write_timeout" default:"10"` RootPath string `yaml:"root_path"` // 可以为空 HeaderTraceID string `yaml:"header_trace_id" default:"X-Request-Id"` ControllerRootPkgName string `yaml:"controller_root_pkg_name" default:"controller"` WebLimiter WebLimiter `yaml:"web_limiter"` }
type HttpMetric ¶
type HttpMetric struct {
// contains filtered or unexported fields
}
func NewHttpMetric ¶
func NewHttpMetric() *HttpMetric
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
var DefaultHttpServer *HttpServer
func InitDefaultHttpServer ¶
func InitDefaultHttpServer(config Config) *HttpServer
func NewHttpServer ¶
func NewHttpServer(config Config) *HttpServer
func (*HttpServer) AddController ¶
func (s *HttpServer) AddController(v interface{})
AddController 只能增加func、point和interface,其他类型直接忽略
func (*HttpServer) AddInterceptor ¶
func (s *HttpServer) AddInterceptor(i interceptor.Interceptor, order int)
func (*HttpServer) Close ¶
func (s *HttpServer) Close()
func (*HttpServer) Register ¶
func (s *HttpServer) Register(controller *RestfulController)
Register 注册restfulController
func (*HttpServer) SetBeforeDispatchCallBack ¶
func (s *HttpServer) SetBeforeDispatchCallBack(callbackFunc BeforeDispatchCallbackFunc)
func (*HttpServer) StartUp ¶
func (s *HttpServer) StartUp()
type RequestCtx ¶
type RequestCtx struct {
// contains filtered or unexported fields
}
func (*RequestCtx) GetParams ¶
func (c *RequestCtx) GetParams() map[string][]string
func (*RequestCtx) GetPath ¶
func (c *RequestCtx) GetPath() string
func (*RequestCtx) GetPathParam ¶
func (c *RequestCtx) GetPathParam() map[string]string
func (*RequestCtx) IsFinish ¶
func (c *RequestCtx) IsFinish() bool
func (*RequestCtx) SetResponse ¶
func (c *RequestCtx) SetResponse(v interface{})
type RestfulController ¶
type RestfulController struct {
// contains filtered or unexported fields
}
func NewRestFul ¶
func NewRestFul() *RestfulController
func (*RestfulController) Action ¶
func (c *RestfulController) Action(action string) *RestfulController
func (*RestfulController) Controller ¶
func (c *RestfulController) Controller(controllerName string) *RestfulController
func (*RestfulController) GetPath ¶
func (c *RestfulController) GetPath() string
func (*RestfulController) GetVersion ¶
func (c *RestfulController) GetVersion() string
func (*RestfulController) Method ¶
func (c *RestfulController) Method(method string) *RestfulController
func (*RestfulController) Path ¶
func (c *RestfulController) Path(path string) *RestfulController
func (*RestfulController) Version ¶
func (c *RestfulController) Version(version string) *RestfulController
type WebLimiter ¶
Click to show internal directories.
Click to hide internal directories.