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

Method TraversalsByName

reflectx/reflect.go:167–179  ·  view source on GitHub ↗

TraversalsByName returns a slice of int slices which represent the struct traversals for each mapped name. Panics if t is not a struct or Indirectable to a struct. Returns empty int slice for each name not found.

(t reflect.Type, names []string)

Source from the content-addressed store, hash-verified

165// traversals for each mapped name. Panics if t is not a struct or Indirectable
166// to a struct. Returns empty int slice for each name not found.
167func (m *Mapper) TraversalsByName(t reflect.Type, names []string) [][]int {
168 r := make([][]int, 0, len(names))
169 m.TraversalsByNameFunc(t, names, func(_ int, i []int) error {
170 if i == nil {
171 r = append(r, []int{})
172 } else {
173 r = append(r, i)
174 }
175
176 return nil
177 })
178 return r
179}
180
181// TraversalsByNameFunc traverses the mapped names and calls fn with the index of
182// each name and the struct traversal represented by that name. Panics if t is not

Callers 6

scanAllFunction · 0.95
TestFieldsEmbeddedFunction · 0.95
StructScanMethod · 0.80
scanAnyMethod · 0.80
TestMapperMethodsByNameFunction · 0.80

Calls 1

TraversalsByNameFuncMethod · 0.95

Tested by 3

TestFieldsEmbeddedFunction · 0.76
TestMapperMethodsByNameFunction · 0.64