From 9e370fb86e38764fa80290f319adcb18996a4a88 Mon Sep 17 00:00:00 2001 From: br3w0r Date: Wed, 27 Mar 2024 19:21:06 +0400 Subject: [PATCH] add noOpScanType --- dbscan/rowscanner.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 }