ValidFieldMap returns the mapper's mapping of field names to reflect valid field values. Panics if v's Kind is not Struct, or v is not Indirectable to a struct kind.
(v reflect.Value)
| 130 | // field values. Panics if v's Kind is not Struct, or v is not Indirectable to |
| 131 | // a struct kind. |
| 132 | func (m *Mapper) ValidFieldMap(v reflect.Value) map[string]reflect.Value { |
| 133 | v = reflect.Indirect(v) |
| 134 | mustBe(v, reflect.Struct) |
| 135 | |
| 136 | r := map[string]reflect.Value{} |
| 137 | tm := m.TypeMap(v.Type()) |
| 138 | for tagName, fi := range tm.Names { |
| 139 | v := ValidFieldByIndexes(v, fi.Index) |
| 140 | if v.IsValid() { |
| 141 | r[tagName] = v |
| 142 | } |
| 143 | } |
| 144 | return r |
| 145 | } |
| 146 | |
| 147 | // FieldByName returns a field by the its mapped name as a reflect.Value. |
| 148 | // Panics if v's Kind is not Struct or v is not Indirectable to a struct Kind. |
no test coverage detected