Documentation
¶
Index ¶
- Constants
- Variables
- type Bind
- type Context
- type Group
- func (g *Group) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) *Route
- func (g *Group) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) GET(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) POST(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) PUT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (g *Group) Use(middleware ...MiddlewareFunc)
- type HandlerFunc
- type Message
- type MiddlewareFunc
- type Route
- type Whisper
- func (e *Whisper) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) *Route
- func (e *Whisper) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route
- func (e *Whisper) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) GET(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) Group(prefix string, m ...MiddlewareFunc) (g *Group)
- func (e *Whisper) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) POST(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) PUT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
- func (e *Whisper) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
Constants ¶
const ( NoErr = http.StatusOK ErrInternal = http.StatusInternalServerError ErrWrongRequest = http.StatusMethodNotAllowed ErrWrongRequestParam = http.StatusNotAcceptable ErrWrongRequestData = http.StatusBadRequest ErrForbidden = http.StatusForbidden ErrNotFound = http.StatusNotFound )
const (
PROPFIND = "PROPFIND"
)
Variables ¶
var ( NotFoundHandler = func(c Context) error { return ErrNotFound222 } MethodNotAllowedHandler = func(c Context) error { return ErrMethodNotAllowed } )
Error handlers
var ( ErrNotFound222 = echo.NewHTTPError(http.StatusNotFound) ErrMethodNotAllowed = echo.NewHTTPError(http.StatusMethodNotAllowed) )
var ErrorsDefault = map[int]string{ NoErr: "Ok", ErrInternal: "Server error", ErrWrongRequest: "Wrong API request", ErrWrongRequestParam: "Wrong request param", ErrWrongRequestData: "Wrong request data", ErrForbidden: "Access denied", ErrNotFound: "Not found", }
Functions ¶
This section is empty.
Types ¶
type Bind ¶ added in v1.3.1
type Bind struct {
Data map[string]interface{}
}
func (*Bind) BindMapParam ¶ added in v1.4.0
func (*Bind) BindMultipart ¶ added in v1.5.0
type Group ¶ added in v1.2.0
type Group struct {
// contains filtered or unexported fields
}
func (*Group) Add ¶ added in v1.2.0
func (g *Group) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) *Route
Add implements `Echo#Add()` for sub-routes within the Group.
func (*Group) CONNECT ¶ added in v1.2.0
func (g *Group) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
CONNECT implements `Echo#CONNECT()` for sub-routes within the Group.
func (*Group) DELETE ¶ added in v1.2.0
func (g *Group) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
DELETE implements `Echo#DELETE()` for sub-routes within the Group.
func (*Group) GET ¶ added in v1.2.0
func (g *Group) GET(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
GET implements `Echo#GET()` for sub-routes within the Group.
func (*Group) HEAD ¶ added in v1.2.0
func (g *Group) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
HEAD implements `Echo#HEAD()` for sub-routes within the Group.
func (*Group) OPTIONS ¶ added in v1.2.0
func (g *Group) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group.
func (*Group) PATCH ¶ added in v1.2.0
func (g *Group) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
PATCH implements `Echo#PATCH()` for sub-routes within the Group.
func (*Group) POST ¶ added in v1.2.0
func (g *Group) POST(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
POST implements `Echo#POST()` for sub-routes within the Group.
func (*Group) PUT ¶ added in v1.2.0
func (g *Group) PUT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
PUT implements `Echo#PUT()` for sub-routes within the Group.
func (*Group) TRACE ¶ added in v1.2.0
func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
TRACE implements `Echo#TRACE()` for sub-routes within the Group.
func (*Group) Use ¶ added in v1.2.0
func (g *Group) Use(middleware ...MiddlewareFunc)
type HandlerFunc ¶
type Message ¶
type Message struct { Err int `json:"error"` Data interface{} `json:"data,omitempty"` ErrMes []string `json:"error_description,omitempty"` }
func NewMessage ¶
func NewMessage() *Message
func (*Message) SetErrCode ¶
func (*Message) SetErrCustom ¶
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
type Whisper ¶
func (*Whisper) Add ¶
func (e *Whisper) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) *Route
func (*Whisper) Any ¶ added in v1.2.0
func (e *Whisper) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route
Any registers a new route for all HTTP methods and path with matching handler in the router with optional route-level middleware.
func (*Whisper) CONNECT ¶
func (e *Whisper) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
CONNECT registers a new CONNECT route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) DELETE ¶
func (e *Whisper) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
DELETE registers a new DELETE route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) GET ¶
func (e *Whisper) GET(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
GET registers a new GET route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) Group ¶ added in v1.2.0
func (e *Whisper) Group(prefix string, m ...MiddlewareFunc) (g *Group)
Group creates a new router group with prefix and optional group-level middleware.
func (*Whisper) HEAD ¶
func (e *Whisper) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
HEAD registers a new HEAD route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) OPTIONS ¶
func (e *Whisper) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
OPTIONS registers a new OPTIONS route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) PATCH ¶
func (e *Whisper) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
PATCH registers a new PATCH route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) POST ¶
func (e *Whisper) POST(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
POST registers a new POST route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) PUT ¶
func (e *Whisper) PUT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
PUT registers a new PUT route for a path with matching handler in the router with optional route-level middleware.
func (*Whisper) TRACE ¶
func (e *Whisper) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route
TRACE registers a new TRACE route for a path with matching handler in the router with optional route-level middleware.