Can you specify name to be case insensitive
190 lines of a reflectx/reflect.go
func (m *Mapper) TraversalsByNameFunc(t reflect.Type, names []string, fn func(int, []int) error) error { t = Deref(t) mustBe(t, reflect.Struct) tm := m.TypeMap(t) for i, name := range names { fi, ok := tm.Names[name] if !ok { if err := fn(i, nil); err != nil { return err } } else { if err := fn(i, fi.Index); err != nil { return err } } } return nil }
#859 sure, To make the TraversalsByNameFunc function in your code case-insensitive, you can modify the fi, ok := tm.Names[name] line to convert the name to lowercase using the strings.ToLower()
you can modify the fi, ok := tm.Names[name] line to convert the name to lowercase using the strings.ToLower() function
tm.Names[strings.ToLower(name)]
This way, the function will find struct fields regardless of the case of their names.
这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。