Documentation ¶
Index ¶
- func CustomHttpErrorHandler(err error, c echo.Context)
- func NewFileBinder(baseBinder echo.Binder) echo.Binder
- type Author
- type ErrResponse
- type HandlerEnable
- func NewHttpHandler[T any](path, method string, ...) HandlerEnable
- func NewJsonHandler[T, R any](path, method string, f func(ctx echo.Context, req T) (resp R, err error), ...) HandlerEnable
- func NewJsonStatusHandler[T, R any](path, method string, successStatus int, ...) HandlerEnable
- func NewNoContentHandler[T any](path, method string, f func(ctx echo.Context, req T) (err error), ...) HandlerEnable
- func NewStreamHandler[T any](path, method string, ...) HandlerEnable
- type Options
- type Router
- type RouterFnc
- type Server
- type ServerGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomHttpErrorHandler ¶
func CustomHttpErrorHandler(err error, c echo.Context)
func NewFileBinder ¶ added in v2.1.0
func NewFileBinder(baseBinder echo.Binder) echo.Binder
Types ¶
type ErrResponse ¶
type ErrResponse struct { Timestamp time.Time `json:"timestamp"` Status int `json:"status"` Error string `json:"error"` Message string `json:"message"` Path string `json:"path"` }
func NewErrResponse ¶
func NewErrResponse(err *echo.HTTPError, c echo.Context) *ErrResponse
type HandlerEnable ¶
type HandlerEnable interface { HandlerFunc() echo.HandlerFunc Method() string Path() string Middlewares() []echo.MiddlewareFunc }
func NewHttpHandler ¶
func NewHttpHandler[T any](path, method string, f func(ctx echo.Context, req T) (handler http.Handler, err error), middleware ...echo.MiddlewareFunc) HandlerEnable
NewHttpHandler 支持 httpHandler 扩展
func NewJsonHandler ¶
func NewJsonHandler[T, R any](path, method string, f func(ctx echo.Context, req T) (resp R, err error), middleware ...echo.MiddlewareFunc) HandlerEnable
NewJsonHandler 返回json
func NewJsonStatusHandler ¶
func NewJsonStatusHandler[T, R any](path, method string, successStatus int, f func(ctx echo.Context, req T) (resp R, err error), middleware ...echo.MiddlewareFunc) HandlerEnable
NewJsonStatusHandler 返回带状态json
func NewNoContentHandler ¶
func NewNoContentHandler[T any](path, method string, f func(ctx echo.Context, req T) (err error), middleware ...echo.MiddlewareFunc) HandlerEnable
NewNoContentHandler 无返回
func NewStreamHandler ¶
func NewStreamHandler[T any](path, method string, f func(ctx echo.Context, req T) (header http.Header, reader io.ReadCloser, err error), middleware ...echo.MiddlewareFunc) HandlerEnable
NewStreamHandler 返回流,用于下载等
type Options ¶
type Options struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` BasePath string `json:"base_path,omitempty" yaml:"base-path,omitempty"` Port int `json:"port,omitempty"` TLSKey string `json:"tls_key,omitempty" yaml:"tls-key,omitempty"` TLSPem string `json:"tls_pem,omitempty" yaml:"tls-pem,omitempty"` // contains filtered or unexported fields }
func (*Options) SetVersion ¶
type Router ¶
type Router interface { AddHandler(handler ...HandlerEnable) Register() error }
type RouterFnc ¶
type RouterFnc func(group *ServerGroup) (Router, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddMiddleware ¶
func (s *Server) AddMiddleware(middleware ...echo.MiddlewareFunc)
func (*Server) AddRouterFnc ¶
func (*Server) RegisterRouters ¶
func (s *Server) RegisterRouters()
type ServerGroup ¶
type ServerGroup struct { *echo.Group Server *Server }
func (*ServerGroup) Author ¶
func (s *ServerGroup) Author(key string) Author
func (*ServerGroup) SubGroup ¶
func (s *ServerGroup) SubGroup(prefix string, funcs ...echo.MiddlewareFunc) *echo.Group
SubGroup 创建子组
Click to show internal directories.
Click to hide internal directories.