2
0

Allow reading any value into []byte

This commit is contained in:
Jack Christensen
2014-09-27 15:34:52 -05:00
parent 6a4284a30c
commit 4e51ff728f
2 changed files with 29 additions and 16 deletions
+7 -1
View File
@@ -214,7 +214,13 @@ func (rows *Rows) Scan(dest ...interface{}) (err error) {
case *bool:
*d = decodeBool(vr)
case *[]byte:
*d = decodeBytea(vr)
// If it actually is a bytea then pass it through decodeBytea (so it can be decoded if it is in text format)
// Otherwise read the bytes directly regardless of what the actual type is.
if vr.Type().DataType == ByteaOid {
*d = decodeBytea(vr)
} else {
*d = vr.ReadBytes(vr.Len())
}
case *int64:
*d = decodeInt8(vr)
case *int16: