mirror of
https://github.com/json-iterator/go.git
synced 2025-04-20 11:28:49 +02:00
parent
10b9ac0971
commit
ffc487c633
@ -2,11 +2,12 @@ package jsoniter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/modern-go/reflect2"
|
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/modern-go/reflect2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder {
|
func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||||
@ -106,15 +107,17 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if typ == textMarshalerType {
|
if typ.Kind() != reflect.String {
|
||||||
return &directTextMarshalerEncoder{
|
if typ == textMarshalerType {
|
||||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
return &directTextMarshalerEncoder{
|
||||||
|
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if typ.Implements(textMarshalerType) {
|
||||||
if typ.Implements(textMarshalerType) {
|
return &textMarshalerEncoder{
|
||||||
return &textMarshalerEncoder{
|
valType: typ,
|
||||||
valType: typ,
|
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
||||||
stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user