Skip to content

Commit

Permalink
chore: add a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Oct 26, 2024
1 parent 39fda4e commit b4e1de0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions model_map.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package bun

import (
"bytes"
"context"
"database/sql"
"reflect"
Expand Down Expand Up @@ -82,11 +83,9 @@ func (m *mapModel) Scan(src interface{}) error {
return m.scanRaw(src)
case reflect.Slice:
if scanType.Elem().Kind() == reflect.Uint8 {
srcB := src.([]byte)
src2 := make([]byte, len(srcB))
copy(src2, srcB)

return m.scanRaw(src2)
// Reference types such as []byte are only valid until the next call to Scan.
src := bytes.Clone(src.([]byte))
return m.scanRaw(src)
}
}

Expand Down

0 comments on commit b4e1de0

Please sign in to comment.