MCPcopy Index your code
hub / github.com/upper/db / TypeMap

Method TypeMap

internal/reflectx/reflect.go:104–113  ·  view source on GitHub ↗

TypeMap returns a mapping of field strings to int slices representing the traversal down the struct to reach the field.

(t reflect.Type)

Source from the content-addressed store, hash-verified

102// TypeMap returns a mapping of field strings to int slices representing
103// the traversal down the struct to reach the field.
104func (m *Mapper) TypeMap(t reflect.Type) *StructMap {
105 m.mutex.Lock()
106 mapping, ok := m.cache[t]
107 if !ok {
108 mapping = getMapping(t, m.tagName, m.mapFunc, m.tagMapFunc)
109 m.cache[t] = mapping
110 }
111 m.mutex.Unlock()
112 return mapping
113}
114
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.

Callers 8

FieldMapMethod · 0.95
ValidFieldMapMethod · 0.95
FieldByNameMethod · 0.95
FieldsByNameMethod · 0.95
TraversalsByNameMethod · 0.95
TestReflectMapperFunction · 0.80
fetchResultFunction · 0.80
MapFunction · 0.80

Calls 1

getMappingFunction · 0.85

Tested by 1

TestReflectMapperFunction · 0.64