Former-commit-id: d79204bb6ff8e495378637481e022b014d7f7bed
This commit is contained in:
Gerasimos (Makis) Maropoulos 2017-10-10 05:25:09 +03:00
parent 7ab607aab2
commit 713e5c3362
2 changed files with 8 additions and 5 deletions

View File

@ -24,6 +24,10 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene
Great news for our **MVC** Fans or if you're not you may want to use that powerful feature today, because of the smart coding and decisions the performance is quite the same to the pure handlers, see [_benchmarks](_benchmarks).
A Controller's field that is an interface can now be binded to any type that implements that interface.
Ability to send HTTP responses based on the Controller's method function's output values, see below;
Iris now gives you the ability to render a response based on the **output values** returned from the controller's method functions!
You can return any value of any type from a method function
@ -164,8 +168,6 @@ func (c *MoviesController) DeleteBy(id int) iris.Map {
Another good example with a typical folder structure, that many developers are used to work, is located at the new [README.md](README.md) under the [Quick MVC Tutorial #3](README.md#quick-mvc-tutorial-3) section.
### The complete example source code can be found at [_examples/mvc/using-method-result](_examples/mvc/using-method-result) folder.
# Fr, 06 October 2017 | v8.4.5
- Badger team added support for transactions [yesterday](https://github.com/dgraph-io/badger/commit/06242925c2f2a5e73dc688e9049004029dd7f9f7), therefore the [badger session database](sessions/sessiondb/badger) is updated via https://github.com/kataras/iris/commit/0b48927562a2202809a7674ebedb738dc3da57e8.

View File

@ -71,11 +71,12 @@ func (b *binder) lookup(elem reflect.Type) (fields []field.Field) {
matcher := func(elemField reflect.StructField) bool {
// If the controller's field is interface then check
// if the given binded value implements that interface.
// i.e MovieController { Service services.MoviesController /* interface */ }
// i.e MovieController { Service services.MovieService /* interface */ }
// app.Controller("/", new(MovieController),
// services.NewMovieMemoryService(...))
// services.NewMovieMemoryService returns a *MovieMemoryService
// that implements the MovieService interface.
//
// `services.NewMovieMemoryService` returns a `*MovieMemoryService`
// that implements the `MovieService` interface.
if elemField.Type.Kind() == reflect.Interface {
return value.Type().Implements(elemField.Type)
}