NewMapperFunc returns a new mapper which optionally obeys a field tag and a struct field name mapper func given by f. Tags will take precedence, but for any other field, the mapped name will be f(field.Name)
(tagName string, f func(string) string)
| 92 | // a struct field name mapper func given by f. Tags will take precedence, but |
| 93 | // for any other field, the mapped name will be f(field.Name) |
| 94 | func NewMapperFunc(tagName string, f func(string) string) *Mapper { |
| 95 | return &Mapper{ |
| 96 | cache: make(map[reflect.Type]*StructMap), |
| 97 | tagName: tagName, |
| 98 | mapFunc: f, |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // TypeMap returns a mapping of field strings to int slices representing |
| 103 | // the traversal down the struct to reach the field. |
no outgoing calls