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

Add Exists() method

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Anon-Penguin 2016-04-21 18:35:49 -05:00 committed by Vishal Rana
parent c830734fd5
commit ea123198e4

View File

@ -88,9 +88,12 @@ type (
// Set saves data in the context.
Set(string, interface{})
// Del data from the context
// Del deletes data from the context.
Del(string)
// Exists checks if that key exists in the context.
Exists(string) bool
// Bind binds the request body into provided type `i`. The default binder
// does it based on Content-Type header.
Bind(interface{}) error
@ -292,6 +295,11 @@ func (c *context) Del(key string) {
delete(c.store, key)
}
func (c *context) Exists(key string) bool {
_, ok := c.store[key]
return ok
}
func (c *context) Bind(i interface{}) error {
return c.echo.binder.Bind(i, c)
}