MCPcopy Create free account
hub / github.com/blues/note / newMapEncoder

Function newMapEncoder

jsonxt/encode.go:708–720  ·  view source on GitHub ↗
(t reflect.Type)

Source from the content-addressed store, hash-verified

706}
707
708func newMapEncoder(t reflect.Type) encoderFunc {
709 switch t.Key().Kind() {
710 case reflect.String,
711 reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
712 reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
713 default:
714 if !t.Key().Implements(textMarshalerType) {
715 return unsupportedTypeEncoder
716 }
717 }
718 me := mapEncoder{typeEncoder(t.Elem())}
719 return me.encode
720}
721
722func encodeByteSlice(e *encodeState, v reflect.Value, _ encOpts) {
723 if v.IsNil() {

Callers 1

newTypeEncoderFunction · 0.85

Calls 1

typeEncoderFunction · 0.85

Tested by

no test coverage detected