mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
Enhance the MVC "using-method-result" example. Prev: update to version 8.5.0
Prev Commit: 49ee8f2d75 [formerly 6a3579f2500fc715d7dc606478960946dcade61d]
Changelog: https://github.com/kataras/iris/blob/master/HISTORY.md#mo-09-october-2017--v850
This example is updated with the current commit: https://github.com/kataras/iris/tree/master/_examples/mvc/using-output-result
Former-commit-id: 29486ef014b3667fa1c7c66e11c8e95c76a37e57
This commit is contained in:
@@ -69,6 +69,16 @@ 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 */ }
|
||||
// app.Controller("/", new(MovieController),
|
||||
// services.NewMovieMemoryController(...))
|
||||
// *MovieMemoryService type
|
||||
// that implements the MovieService interface.
|
||||
if elemField.Type.Kind() == reflect.Interface {
|
||||
return value.Type().Implements(elemField.Type)
|
||||
}
|
||||
return elemField.Type == value.Type()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user