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

Method CodecEncodeSelf

benchmark/benchmark_codecgen.go:2370–2462  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(e *codec1978.Encoder)

Source from the content-addressed store, hash-verified

2368
2369// Benchmark harness support for STK-REQ-004.
2370func (x *LargePayload) CodecEncodeSelf(e *codec1978.Encoder) {
2371 var h codecSelfer6617
2372 z, r := codec1978.GenHelperEncoder(e)
2373 _, _, _ = h, z, r
2374 if x == nil {
2375 r.EncodeNil()
2376 } else {
2377 if false {
2378 } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
2379 z.EncExtension(x, yyxt1)
2380 } else if !z.EncBinary() && z.IsJSONHandle() {
2381 z.EncJSONMarshal(x)
2382 } else {
2383 yysep2 := !z.EncBinary()
2384 yy2arr2 := z.EncBasicHandle().StructToArray
2385 _, _ = yysep2, yy2arr2
2386 const yyr2 bool = false // struct tag has 'toArray'
2387 if yyr2 || yy2arr2 {
2388 r.WriteArrayStart(2)
2389 } else {
2390 r.WriteMapStart(2)
2391 }
2392 if yyr2 || yy2arr2 {
2393 r.WriteArrayElem()
2394 if x.Users == nil {
2395 r.EncodeNil()
2396 } else {
2397 if false {
2398 } else {
2399 h.encSlicePtrtoDSUser(([]*DSUser)(x.Users), e)
2400 }
2401 }
2402 } else {
2403 r.WriteMapElemKey()
2404 if z.IsJSONHandle() {
2405 z.WriteStr("\"Users\"")
2406 } else {
2407 r.EncodeStringEnc(codecSelferCcUTF86617, `Users`)
2408 }
2409 r.WriteMapElemValue()
2410 if x.Users == nil {
2411 r.EncodeNil()
2412 } else {
2413 if false {
2414 } else {
2415 h.encSlicePtrtoDSUser(([]*DSUser)(x.Users), e)
2416 }
2417 }
2418 }
2419 var yyn6 bool
2420 if x.Topics == nil {
2421 yyn6 = true
2422 goto LABEL6
2423 }
2424 LABEL6:
2425 if yyr2 || yy2arr2 {
2426 if yyn6 {
2427 r.WriteArrayElem()

Callers

nothing calls this directly

Calls 2

encSlicePtrtoDSUserMethod · 0.95
CodecEncodeSelfMethod · 0.45

Tested by

no test coverage detected