1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-26 22:37:08 +00:00

create a new package, name it as hero, I was thinking super or superb but hero is better name for what it does - the goal is to split the new 'mvc handlers' from the mvc system because they are not the same, users should know that they can use these type of rich binded handlers without controllers as well, like a normal handler and that I implemented here, the old files exist on the mvc package but will be removed at the next commit, I have to decide if we want type aliases for Result or no

Former-commit-id: cb775edc72bedc88aeab4c5a6de6bfc6bd56fae2
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-12-25 20:05:32 +02:00
parent 4ab889da5f
commit 46505f62db
43 changed files with 2680 additions and 20 deletions

View File

@@ -92,15 +92,27 @@ 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.
var emptyEntry memstore.Entry
// GetEntryAt returns the internal Entry of the memstore based on its index,
// the stored index by the router.
// If not found then it returns a zero Entry and false.
func (r RequestParams) GetEntryAt(index int) (memstore.Entry, bool) {
if len(r.store) > index {
return r.store[index], true
}
return emptyEntry, false
}
// GetEntry returns the internal Entry of the memstore based on its "key".
// 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
return emptyEntry, false
}
// Get returns a path parameter's value based on its route's dynamic path key.