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

Function isScannable

sqlx.go:56–67  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

54// - it implements sql.Scanner
55// - it has no exported fields
56func 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
70type ColScanner interface {

Callers 2

scanAnyMethod · 0.85
scanAllFunction · 0.85

Calls 3

mapperFunction · 0.85
KindMethod · 0.80
TypeMapMethod · 0.80

Tested by

no test coverage detected