1
0
mirror of https://github.com/kataras/iris.git synced 2026-03-06 16:35:57 +00:00

give some more control over request params and their entries for the end-developers

Former-commit-id: 91362d3de5c63faf0d124e66747e40ad0df04fbb
This commit is contained in:
kataras
2017-11-23 12:30:13 +02:00
parent 56871ce4d7
commit 907ba28f84
10 changed files with 482 additions and 76 deletions

View File

@@ -91,6 +91,17 @@ func (r *RequestParams) Visit(visitor func(key string, value string)) {
})
}
// GetEntry returns the internal Entry of the memstore, as value
// if not found then it returns a zero Entry and false.
func (r RequestParams) GetEntry(key string) (memstore.Entry, bool) {
// we don't return the pointer here, we don't want to give the end-developer
// the strength to change the entry that way.
if e := r.store.GetEntry(key); e != nil {
return *e, true
}
return memstore.Entry{}, false
}
// Get returns a path parameter's value based on its route's dynamic path key.
func (r RequestParams) Get(key string) string {
return r.store.GetString(key)