MCPcopy Create free account
hub / github.com/upper/db / FieldMap

Method FieldMap

internal/reflectx/reflect.go:117–127  ·  view source on GitHub ↗

FieldMap returns the mapper's mapping of field names to reflect values. Panics if v's Kind is not Struct, or v is not Indirectable to a struct kind.

(v reflect.Value)

Source from the content-addressed store, hash-verified

115// FieldMap returns the mapper's mapping of field names to reflect values. Panics
116// if v's Kind is not Struct, or v is not Indirectable to a struct kind.
117func (m *Mapper) FieldMap(v reflect.Value) map[string]reflect.Value {
118 v = reflect.Indirect(v)
119 mustBe(v, reflect.Struct)
120
121 r := map[string]reflect.Value{}
122 tm := m.TypeMap(v.Type())
123 for tagName, fi := range tm.Names {
124 r[tagName] = FieldByIndexes(v, fi.Index)
125 }
126 return r
127}
128
129// ValidFieldMap returns the mapper's mapping of field names to reflect valid
130// field values. Panics if v's Kind is not Struct, or v is not Indirectable to

Callers

nothing calls this directly

Calls 3

TypeMapMethod · 0.95
mustBeFunction · 0.85
FieldByIndexesFunction · 0.85

Tested by

no test coverage detected