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:
parent
d5b3fef5c9
commit
60ce130499
@ -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
|
||||
}
|
||||
|
5
echo.go
5
echo.go
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user