MCPcopy
hub / github.com/jmoiron/sqlx / TypeMap

Method TypeMap

reflectx/reflect.go:104–113  ·  reflectx/reflect.go::Mapper.TypeMap

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 15

TestEmbeddedSimpleFunction · 0.95
TestFieldsEmbeddedFunction · 0.95
FieldMapMethod · 0.95
FieldByNameMethod · 0.95
FieldsByNameMethod · 0.95
TraversalsByNameFuncMethod · 0.95
isScannableFunction · 0.80
TestBasicEmbeddedFunction · 0.80
TestInlineStructFunction · 0.80
TestRecursiveStructFunction · 0.80

Calls 1

getMappingFunction · 0.85

Tested by 12

TestEmbeddedSimpleFunction · 0.76
TestFieldsEmbeddedFunction · 0.76
TestBasicEmbeddedFunction · 0.64
TestInlineStructFunction · 0.64
TestRecursiveStructFunction · 0.64
TestPtrFieldsFunction · 0.64
TestNamedPtrFieldsFunction · 0.64
TestTagNameMappingFunction · 0.64
TestMappingFunction · 0.64
TestGetByTraversalFunction · 0.64