MCPcopy Create free account
hub / github.com/buger/jsonparser / CodecEncodeSelf

Method CodecEncodeSelf

benchmark/benchmark_codecgen.go:1217–1354  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(e *codec1978.Encoder)

Source from the content-addressed store, hash-verified

1215
1216// Benchmark harness support for STK-REQ-004.
1217func (x *CBPerson) CodecEncodeSelf(e *codec1978.Encoder) {
1218 var h codecSelfer6617
1219 z, r := codec1978.GenHelperEncoder(e)
1220 _, _, _ = h, z, r
1221 if x == nil {
1222 r.EncodeNil()
1223 } else {
1224 if false {
1225 } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
1226 z.EncExtension(x, yyxt1)
1227 } else if !z.EncBinary() && z.IsJSONHandle() {
1228 z.EncJSONMarshal(x)
1229 } else {
1230 yysep2 := !z.EncBinary()
1231 yy2arr2 := z.EncBasicHandle().StructToArray
1232 _, _ = yysep2, yy2arr2
1233 const yyr2 bool = false // struct tag has 'toArray'
1234 if yyr2 || yy2arr2 {
1235 r.WriteArrayStart(3)
1236 } else {
1237 r.WriteMapStart(3)
1238 }
1239 var yyn3 bool
1240 if x.Name == nil {
1241 yyn3 = true
1242 goto LABEL3
1243 }
1244 LABEL3:
1245 if yyr2 || yy2arr2 {
1246 if yyn3 {
1247 r.WriteArrayElem()
1248 r.EncodeNil()
1249 } else {
1250 r.WriteArrayElem()
1251 if x.Name == nil {
1252 r.EncodeNil()
1253 } else {
1254 x.Name.CodecEncodeSelf(e)
1255 }
1256 }
1257 } else {
1258 r.WriteMapElemKey()
1259 if z.IsJSONHandle() {
1260 z.WriteStr("\"Name\"")
1261 } else {
1262 r.EncodeStringEnc(codecSelferCcUTF86617, `Name`)
1263 }
1264 r.WriteMapElemValue()
1265 if yyn3 {
1266 r.EncodeNil()
1267 } else {
1268 if x.Name == nil {
1269 r.EncodeNil()
1270 } else {
1271 x.Name.CodecEncodeSelf(e)
1272 }
1273 }
1274 }

Callers

nothing calls this directly

Calls 1

CodecEncodeSelfMethod · 0.45

Tested by

no test coverage detected