diff --git a/dbscan/rowscanner.go b/dbscan/rowscanner.go index 0e9f6bf..d88ad9f 100644 --- a/dbscan/rowscanner.go +++ b/dbscan/rowscanner.go @@ -1,6 +1,7 @@ package dbscan import ( + "database/sql/driver" "fmt" "reflect" ) @@ -123,13 +124,23 @@ func startScanner(rs *RowScanner, dstValue reflect.Value) error { ) } +type noOpScanType struct{} + +func (*noOpScanType) Scan(value interface{}) error { + return nil +} + +func (noOpScanType) Value() (driver.Value, error) { + return nil, nil +} + func (rs *RowScanner) scanStruct(structValue reflect.Value) error { scans := make([]interface{}, len(rs.columns)) for i, column := range rs.columns { fieldIndex, ok := rs.columnToFieldIndex[column] if !ok { if rs.api.allowUnknownColumns { - var tmp interface{} + var tmp noOpScanType scans[i] = &tmp continue }