2
0

Improve error message when failing to scan a NULL::json

This commit is contained in:
Jack Christensen
2022-08-22 20:56:36 -05:00
parent 0d5d8e0137
commit 2e73d1e8ee
2 changed files with 38 additions and 0 deletions
+3
View File
@@ -3,6 +3,7 @@ package pgtype
import (
"database/sql/driver"
"encoding/json"
"fmt"
"reflect"
)
@@ -129,6 +130,8 @@ func (scanPlanJSONToJSONUnmarshal) Scan(src []byte, dst any) error {
return nil
}
}
return fmt.Errorf("cannot scan null into %T", dst)
}
return json.Unmarshal(src, dst)