2
0

Merge branch 'master' into v3-experimental

This commit is contained in:
Jack Christensen
2016-12-10 12:21:08 -06:00
26 changed files with 2500 additions and 239 deletions
+6 -2
View File
@@ -298,13 +298,17 @@ func (rows *Rows) Scan(dest ...interface{}) (err error) {
if err != nil {
rows.Fatal(scanArgError{col: i, err: err})
}
} else if vr.Type().DataType == JSONOID || vr.Type().DataType == JSONBOID {
} else if vr.Type().DataType == JSONOID {
// Because the argument passed to decodeJSON will escape the heap.
// This allows d to be stack allocated and only copied to the heap when
// we actually are decoding JSON. This saves one memory allocation per
// row.
d2 := d
decodeJSON(vr, &d2)
} else if vr.Type().DataType == JSONBOID {
// Same trick as above for getting stack allocation
d2 := d
decodeJSONB(vr, &d2)
} else {
if err := Decode(vr, d); err != nil {
rows.Fatal(scanArgError{col: i, err: err})
@@ -393,7 +397,7 @@ func (rows *Rows) Values() ([]interface{}, error) {
values = append(values, d)
case JSONBOID:
var d interface{}
decodeJSON(vr, &d)
decodeJSONB(vr, &d)
values = append(values, d)
default:
rows.Fatal(errors.New("Values cannot handle binary format non-intrinsic types"))