1
0
mirror of https://github.com/json-iterator/go.git synced 2025-11-26 22:40:13 +02:00

support TextMarshaler as map key

This commit is contained in:
Tao Wen
2017-06-06 00:09:33 +08:00
parent 5fd09f0e02
commit 3979955e69
3 changed files with 59 additions and 33 deletions

View File

@@ -6,6 +6,7 @@ import (
"sync/atomic"
"unsafe"
"encoding/json"
"encoding"
)
/*
@@ -77,6 +78,7 @@ var jsonRawMessageType reflect.Type
var anyType reflect.Type
var marshalerType reflect.Type
var unmarshalerType reflect.Type
var textUnmarshalerType reflect.Type
func init() {
typeDecoders = map[string]Decoder{}
@@ -91,6 +93,7 @@ func init() {
anyType = reflect.TypeOf((*Any)(nil)).Elem()
marshalerType = reflect.TypeOf((*json.Marshaler)(nil)).Elem()
unmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
}
func addDecoderToCache(cacheKey reflect.Type, decoder Decoder) {