1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

generic map Map

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2016-10-13 16:45:27 -07:00
parent d5b3fef5c9
commit 60ce130499
2 changed files with 6 additions and 5 deletions

View File

@ -198,11 +198,9 @@ type (
pvalues []string
query url.Values
handler HandlerFunc
store store
store Map
echo *Echo
}
store map[string]interface{}
)
const (
@ -349,7 +347,7 @@ func (c *context) Cookies() []*http.Cookie {
func (c *context) Set(key string, val interface{}) {
if c.store == nil {
c.store = make(store)
c.store = make(Map)
}
c.store[key] = val
}

View File

@ -118,6 +118,9 @@ type (
Renderer interface {
Render(io.Writer, string, interface{}, Context) error
}
// Map defines a generic map of type `map[string]interface{}`.
Map map[string]interface{}
)
// HTTP methods
@ -265,7 +268,7 @@ func (e *Echo) NewContext(r *http.Request, w http.ResponseWriter) Context {
return &context{
request: r,
response: NewResponse(w, e),
store: make(store),
store: make(Map),
echo: e,
pvalues: make([]string, *e.maxParam),
handler: NotFoundHandler,