mapper returns a valid mapper using the configured NameMapper func.
()
| 35 | |
| 36 | // mapper returns a valid mapper using the configured NameMapper func. |
| 37 | func mapper() *reflectx.Mapper { |
| 38 | mprMu.Lock() |
| 39 | defer mprMu.Unlock() |
| 40 | |
| 41 | if mpr == nil { |
| 42 | mpr = reflectx.NewMapperFunc("db", NameMapper) |
| 43 | } else if origMapper != reflect.ValueOf(NameMapper) { |
| 44 | // if NameMapper has changed, create a new mapper |
| 45 | mpr = reflectx.NewMapperFunc("db", NameMapper) |
| 46 | origMapper = reflect.ValueOf(NameMapper) |
| 47 | } |
| 48 | return mpr |
| 49 | } |
| 50 | |
| 51 | // isScannable takes the reflect.Type and the actual dest value and returns |
| 52 | // whether or not it's Scannable. Something is scannable if: |