2
0

Add json/jsonb to pgtype

This commit is contained in:
Jack Christensen
2017-03-11 18:46:51 -06:00
parent 743b98b298
commit 542eac08c6
7 changed files with 438 additions and 18 deletions
-11
View File
@@ -263,17 +263,6 @@ func (rows *Rows) Scan(dest ...interface{}) (err error) {
if err != nil {
rows.Fatal(scanArgError{col: i, err: err})
}
} 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 pgVal, present := rows.conn.oidPgtypeValues[vr.Type().DataType]; present {
switch vr.Type().FormatCode {