2
0

Simplify []byte scanning

This commit is contained in:
Jack Christensen
2017-03-18 14:42:36 -05:00
parent 015108be9a
commit 92cff1d961
7 changed files with 39 additions and 39 deletions
+10
View File
@@ -49,6 +49,16 @@ func (src *Text) AssignTo(dst interface{}) error {
return fmt.Errorf("cannot assign %v to %T", src, dst)
}
*v = src.String
case *[]byte:
switch src.Status {
case Present:
*v = make([]byte, len(src.String))
copy(*v, src.String)
case Null:
*v = nil
default:
return fmt.Errorf("unknown status")
}
default:
if v := reflect.ValueOf(dst); v.Kind() == reflect.Ptr {
el := v.Elem()