MCPcopy
hub / github.com/ugorji/go / EncMapStringIntfV

Method EncMapStringIntfV

codec/fast-path.generated.go:998–1023  ·  view source on GitHub ↗
(v map[string]interface{}, e *Encoder)

Source from the content-addressed store, hash-verified

996 fastpathTV.EncMapStringIntfV(rv2i(rv).(map[string]interface{}), e)
997}
998func (fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) {
999 e.mapStart(len(v))
1000 if e.h.Canonical {
1001 v2 := make([]string, len(v))
1002 var i uint
1003 for k := range v {
1004 v2[i] = k
1005 i++
1006 }
1007 sort.Sort(stringSlice(v2))
1008 for _, k2 := range v2 {
1009 e.mapElemKey()
1010 e.e.EncodeString(k2)
1011 e.mapElemValue()
1012 e.encode(v[k2])
1013 }
1014 } else {
1015 for k2, v2 := range v {
1016 e.mapElemKey()
1017 e.e.EncodeString(k2)
1018 e.mapElemValue()
1019 e.encode(v2)
1020 }
1021 }
1022 e.mapEnd()
1023}
1024func (e *Encoder) fastpathEncMapStringStringR(f *codecFnInfo, rv reflect.Value) {
1025 fastpathTV.EncMapStringStringV(rv2i(rv).(map[string]string), e)
1026}

Callers 5

CodecEncodeSelfMethod · 0.80
fastpathEncodeTypeSwitchFunction · 0.80
CodecEncodeSelfMethod · 0.80
CodecEncodeSelfMethod · 0.80

Calls 7

stringSliceTypeAlias · 0.85
encodeMethod · 0.80
EncodeStringMethod · 0.65
mapStartMethod · 0.45
mapElemKeyMethod · 0.45
mapElemValueMethod · 0.45
mapEndMethod · 0.45

Tested by 3

CodecEncodeSelfMethod · 0.64
CodecEncodeSelfMethod · 0.64
CodecEncodeSelfMethod · 0.64