mirror of
https://github.com/labstack/echo.git
synced 2025-06-06 23:46:16 +02:00
Add Exists() method
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
c830734fd5
commit
ea123198e4
10
context.go
10
context.go
@ -88,9 +88,12 @@ type (
|
|||||||
// Set saves data in the context.
|
// Set saves data in the context.
|
||||||
Set(string, interface{})
|
Set(string, interface{})
|
||||||
|
|
||||||
// Del data from the context
|
// Del deletes data from the context.
|
||||||
Del(string)
|
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
|
// Bind binds the request body into provided type `i`. The default binder
|
||||||
// does it based on Content-Type header.
|
// does it based on Content-Type header.
|
||||||
Bind(interface{}) error
|
Bind(interface{}) error
|
||||||
@ -292,6 +295,11 @@ func (c *context) Del(key string) {
|
|||||||
delete(c.store, key)
|
delete(c.store, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *context) Exists(key string) bool {
|
||||||
|
_, ok := c.store[key]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
func (c *context) Bind(i interface{}) error {
|
func (c *context) Bind(i interface{}) error {
|
||||||
return c.echo.binder.Bind(i, c)
|
return c.echo.binder.Bind(i, c)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user