1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

finish the first state of the vuejs todo mvc example, a simple rest api - todo: websocket and live updates between browser tabs with the same session id

Former-commit-id: 0bd859420cff87014479c44a471ec273c621c1a2
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-12-23 17:07:39 +02:00
parent a2f217be17
commit e1c65d23fb
11 changed files with 232 additions and 190 deletions

View File

@@ -18,6 +18,8 @@ type (
FieldIndex []int
}
// StructInjector keeps the data that are needed in order to do the binding injection
// as fast as possible and with the best possible and safest way.
StructInjector struct {
initRef reflect.Value
initRefAsSlice []reflect.Value // useful when the struct is passed on a func as input args via reflection.
@@ -42,6 +44,12 @@ func (s *StructInjector) countBindType(typ BindType) (n int) {
return
}
// MakeStructInjector returns a new struct injector, which will be the object
// that the caller should use to bind exported fields or
// embedded unexported fields that contain exported fields
// of the "v" struct value or pointer.
//
// The hijack and the goodFunc are optional, the "values" is the dependencies values.
func MakeStructInjector(v reflect.Value, hijack Hijacker, goodFunc TypeChecker, values ...reflect.Value) *StructInjector {
s := &StructInjector{
initRef: v,
@@ -149,6 +157,7 @@ func (s *StructInjector) fillStruct() {
}
}
// String returns a debug trace message.
func (s *StructInjector) String() (trace string) {
for i, f := range s.fields {
elemField := s.elemType.FieldByIndex(f.FieldIndex)