isScannable takes the reflect.Type and the actual dest value and returns whether or not it's Scannable. Something is scannable if: - it is not a struct - it implements sql.Scanner - it has no exported fields
(t reflect.Type)
| 54 | // - it implements sql.Scanner |
| 55 | // - it has no exported fields |
| 56 | func isScannable(t reflect.Type) bool { |
| 57 | if reflect.PtrTo(t).Implements(_scannerInterface) { |
| 58 | return true |
| 59 | } |
| 60 | if t.Kind() != reflect.Struct { |
| 61 | return true |
| 62 | } |
| 63 | |
| 64 | // it's not important that we use the right mapper for this particular object, |
| 65 | // we're only concerned on how many exported fields this struct has |
| 66 | return len(mapper().TypeMap(t).Index) == 0 |
| 67 | } |
| 68 | |
| 69 | // ColScanner is an interface used by MapScan and SliceScan |
| 70 | type ColScanner interface { |