@@ -96,11 +96,14 @@ func (c *Converter) Scan(srcValue any, dstPointer any, option ...ScanOption) (er
9696 }
9797
9898 // Get the element type and kind of dstPointer
99- var (
100- dstPointerReflectValueElem = dstPointerReflectValue .Elem ()
101- dstPointerReflectValueElemKind = dstPointerReflectValueElem .Kind ()
102- )
99+ var dstPointerReflectValueElem = dstPointerReflectValue .Elem ()
100+ // Check if srcValue and dstPointer are the same type, in which case direct assignment can be performed
101+ if ok := c .doConvertWithTypeCheck (srcValueReflectValue , dstPointerReflectValueElem ); ok {
102+ return nil
103+ }
104+
103105 // Handle multiple level pointers
106+ var dstPointerReflectValueElemKind = dstPointerReflectValueElem .Kind ()
104107 if dstPointerReflectValueElemKind == reflect .Pointer {
105108 if dstPointerReflectValueElem .IsNil () {
106109 // Create a new value for the pointer dereference
@@ -114,11 +117,6 @@ func (c *Converter) Scan(srcValue any, dstPointer any, option ...ScanOption) (er
114117 return c .Scan (srcValueReflectValue , dstPointerReflectValueElem , option ... )
115118 }
116119
117- // Check if srcValue and dstPointer are the same type, in which case direct assignment can be performed
118- if ok := c .doConvertWithTypeCheck (srcValueReflectValue , dstPointerReflectValueElem ); ok {
119- return nil
120- }
121-
122120 scanOption := c .getScanOption (option ... )
123121 // Handle different destination types
124122 switch dstPointerReflectValueElemKind {
0 commit comments