Skip to content

Commit

Permalink
fix: use correct type for decoding bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
larkee committed Jan 13, 2021
1 parent c013a64 commit 49d08fc
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package spannerdriver

import (
"database/sql/driver"
"encoding/base64"
"io"
"log"
"sync"
Expand Down Expand Up @@ -115,19 +114,11 @@ func (r *rows) Next(dest []driver.Value) error {
dest[i] = v.StringVal
case sppb.TypeCode_BYTES:
// The column value is a base64 encoded string.
var v spanner.NullString
var v []byte
if err := col.Decode(&v); err != nil {
return err
}
if v.IsNull() {
dest[i] = []byte(nil)
} else {
b, err := base64.StdEncoding.DecodeString(v.StringVal)
if err != nil {
return err
}
dest[i] = b
}
dest[i] = v
case sppb.TypeCode_BOOL:
var v spanner.NullBool
if err := col.Decode(&v); err != nil {
Expand Down

0 comments on commit 49d08fc

Please sign in to comment.