Documentation
¶
Overview ¶
Package SpringEcho 封装 github.com/labstack/echo 实现的 Web 框架
Index ¶
- func EchoContext(ctx web.Context) echo.Context
- func Filter(fn echo.MiddlewareFunc) web.Filter
- func Handler(fn echo.HandlerFunc) web.Handler
- func HandlerWrapper(fn web.Handler, wildCardName string, filters []web.Filter) echo.HandlerFunc
- func WebContext(echoCtx echo.Context) web.Context
- type Container
- type Context
- func (ctx *Context) Attachment(file string, name string)
- func (ctx *Context) Bind(i interface{}) error
- func (ctx *Context) Blob(contentType string, b []byte)
- func (ctx *Context) ClientIP() string
- func (ctx *Context) ContentType() string
- func (ctx *Context) Context() context.Context
- func (ctx *Context) Cookie(name string) (*http.Cookie, error)
- func (ctx *Context) Cookies() []*http.Cookie
- func (ctx *Context) File(file string)
- func (ctx *Context) FormFile(name string) (*multipart.FileHeader, error)
- func (ctx *Context) FormParams() (url.Values, error)
- func (ctx *Context) FormValue(name string) string
- func (ctx *Context) GetHeader(key string) string
- func (ctx *Context) GetRawData() ([]byte, error)
- func (ctx *Context) HTML(html string)
- func (ctx *Context) HTMLBlob(b []byte)
- func (ctx *Context) Handler() web.Handler
- func (ctx *Context) Header(key, value string)
- func (ctx *Context) Inline(file string, name string)
- func (ctx *Context) IsTLS() bool
- func (ctx *Context) IsWebSocket() bool
- func (ctx *Context) JSON(i interface{})
- func (ctx *Context) JSONBlob(b []byte)
- func (ctx *Context) JSONP(callback string, i interface{})
- func (ctx *Context) JSONPBlob(callback string, b []byte)
- func (ctx *Context) JSONPretty(i interface{}, indent string)
- func (ctx *Context) MultipartForm() (*multipart.Form, error)
- func (ctx *Context) NativeContext() interface{}
- func (ctx *Context) NoContent(code int)
- func (ctx *Context) Path() string
- func (ctx *Context) PathParam(name string) string
- func (ctx *Context) PathParamNames() []string
- func (ctx *Context) PathParamValues() []string
- func (ctx *Context) QueryParam(name string) string
- func (ctx *Context) QueryParams() url.Values
- func (ctx *Context) QueryString() string
- func (ctx *Context) Redirect(code int, url string)
- func (ctx *Context) Request() *http.Request
- func (ctx *Context) ResponseWriter() web.ResponseWriter
- func (ctx *Context) SSEvent(name string, message interface{})
- func (ctx *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error
- func (ctx *Context) Scheme() string
- func (ctx *Context) SetCookie(cookie *http.Cookie)
- func (ctx *Context) SetRequest(r *http.Request)
- func (ctx *Context) Status(code int)
- func (ctx *Context) String(format string, values ...interface{})
- func (ctx *Context) XML(i interface{})
- func (ctx *Context) XMLBlob(b []byte)
- func (ctx *Context) XMLPretty(i interface{}, indent string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EchoContext ¶
EchoContext 将 web.Context 转换为 echo.Context
func Handler ¶ added in v1.1.0
func Handler(fn echo.HandlerFunc) web.Handler
Handler 适配 echo 形式的处理函数
func HandlerWrapper ¶
HandlerWrapper Web 处理函数包装器
Types ¶
type Container ¶
type Container struct { *web.AbstractContainer // contains filtered or unexported fields }
Container echo 实现的 Web 容器
func NewContainer ¶
func NewContainer(config web.ContainerConfig) *Container
NewContainer 创建 echo 实现的 Web 容器
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context 适配 echo 的 Web 上下文
func NewContext ¶
NewContext Context 的构造函数
func (*Context) Attachment ¶
Attachment sends a response as attachment
func (*Context) ClientIP ¶
ClientIP implements a best effort algorithm to return the real client IP.
func (*Context) ContentType ¶
ContentType returns the Content-Type header of the request.
func (*Context) FormFile ¶
func (ctx *Context) FormFile(name string) (*multipart.FileHeader, error)
FormFile returns the multipart form file for the provided name.
func (*Context) FormParams ¶
FormParams returns the form parameters as `url.Values`.
func (*Context) GetRawData ¶
GetRawData return stream data.
func (*Context) IsWebSocket ¶
IsWebSocket returns true if HTTP connection is WebSocket otherwise false.
func (*Context) JSONPretty ¶
JSONPretty sends a pretty-print JSON.
func (*Context) MultipartForm ¶
MultipartForm returns the multipart form.
func (*Context) NativeContext ¶
func (ctx *Context) NativeContext() interface{}
NativeContext 返回封装的底层上下文对象
func (*Context) PathParamNames ¶
PathParamNames returns path parameter names.
func (*Context) PathParamValues ¶
PathParamValues returns path parameter values.
func (*Context) QueryParam ¶
QueryParam returns the query param for the provided name.
func (*Context) QueryParams ¶
QueryParams returns the query parameters as `url.Values`.
func (*Context) QueryString ¶
QueryString returns the URL query string.
func (*Context) ResponseWriter ¶
func (ctx *Context) ResponseWriter() web.ResponseWriter
ResponseWriter returns `http.ResponseWriter`.
func (*Context) SaveUploadedFile ¶
func (ctx *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error
SaveUploadedFile uploads the form file to specific dst.
func (*Context) SetRequest ¶
SetRequest sets `*http.Request`.