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

Method CodecEncodeSelf

benchmark/benchmark_codecgen.go:563–619  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(e *codec1978.Encoder)

Source from the content-addressed store, hash-verified

561
562// Benchmark harness support for STK-REQ-004.
563func (x *CBAvatar) CodecEncodeSelf(e *codec1978.Encoder) {
564 var h codecSelfer6617
565 z, r := codec1978.GenHelperEncoder(e)
566 _, _, _ = h, z, r
567 if x == nil {
568 r.EncodeNil()
569 } else {
570 if false {
571 } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
572 z.EncExtension(x, yyxt1)
573 } else if !z.EncBinary() && z.IsJSONHandle() {
574 z.EncJSONMarshal(x)
575 } else {
576 yysep2 := !z.EncBinary()
577 yy2arr2 := z.EncBasicHandle().StructToArray
578 _, _ = yysep2, yy2arr2
579 const yyr2 bool = false // struct tag has 'toArray'
580 if yyr2 || yy2arr2 {
581 r.WriteArrayStart(1)
582 } else {
583 r.WriteMapStart(1)
584 }
585 if yyr2 || yy2arr2 {
586 r.WriteArrayElem()
587 if false {
588 } else {
589 if z.EncBasicHandle().StringToRaw {
590 r.EncodeStringBytesRaw(z.BytesView(string(x.Url)))
591 } else {
592 r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Url))
593 }
594 }
595 } else {
596 r.WriteMapElemKey()
597 if z.IsJSONHandle() {
598 z.WriteStr("\"Url\"")
599 } else {
600 r.EncodeStringEnc(codecSelferCcUTF86617, `Url`)
601 }
602 r.WriteMapElemValue()
603 if false {
604 } else {
605 if z.EncBasicHandle().StringToRaw {
606 r.EncodeStringBytesRaw(z.BytesView(string(x.Url)))
607 } else {
608 r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Url))
609 }
610 }
611 }
612 if yyr2 || yy2arr2 {
613 r.WriteArrayEnd()
614 } else {
615 r.WriteMapEnd()
616 }
617 }
618 }
619}
620

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected