Simply typed nil and driver.Valuer handling
* Convert typed nils to untyped nils at beginning of encoding process. * Restore v4 json/jsonb null behavior * Add anynil internal package
This commit is contained in:
+2
-2
@@ -48,8 +48,8 @@ func TestJSONCodec(t *testing.T) {
|
||||
{map[string]interface{}{"foo": "bar"}, new(map[string]interface{}), isExpectedEqMap(map[string]interface{}{"foo": "bar"})},
|
||||
{jsonStruct{Name: "Adam", Age: 10}, new(jsonStruct), isExpectedEq(jsonStruct{Name: "Adam", Age: 10})},
|
||||
{nil, new(*jsonStruct), isExpectedEq((*jsonStruct)(nil))},
|
||||
{map[string]interface{}(nil), new(string), isExpectedEq(`null`)},
|
||||
{map[string]interface{}(nil), new([]byte), isExpectedEqBytes([]byte("null"))},
|
||||
{map[string]interface{}(nil), new(*string), isExpectedEq((*string)(nil))},
|
||||
{map[string]interface{}(nil), new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
{[]byte(nil), new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
{nil, new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
})
|
||||
|
||||
@@ -21,8 +21,8 @@ func TestJSONBTranscode(t *testing.T) {
|
||||
{map[string]interface{}{"foo": "bar"}, new(map[string]interface{}), isExpectedEqMap(map[string]interface{}{"foo": "bar"})},
|
||||
{jsonStruct{Name: "Adam", Age: 10}, new(jsonStruct), isExpectedEq(jsonStruct{Name: "Adam", Age: 10})},
|
||||
{nil, new(*jsonStruct), isExpectedEq((*jsonStruct)(nil))},
|
||||
{map[string]interface{}(nil), new(string), isExpectedEq(`null`)},
|
||||
{map[string]interface{}(nil), new([]byte), isExpectedEqBytes([]byte("null"))},
|
||||
{map[string]interface{}(nil), new(*string), isExpectedEq((*string)(nil))},
|
||||
{map[string]interface{}(nil), new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
{[]byte(nil), new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
{nil, new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user