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

Method CodecEncodeSelf

benchmark/benchmark_codecgen.go:1782–1838  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(e *codec1978.Encoder)

Source from the content-addressed store, hash-verified

1780
1781// Benchmark harness support for STK-REQ-004.
1782func (x *DSUser) CodecEncodeSelf(e *codec1978.Encoder) {
1783 var h codecSelfer6617
1784 z, r := codec1978.GenHelperEncoder(e)
1785 _, _, _ = h, z, r
1786 if x == nil {
1787 r.EncodeNil()
1788 } else {
1789 if false {
1790 } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
1791 z.EncExtension(x, yyxt1)
1792 } else if !z.EncBinary() && z.IsJSONHandle() {
1793 z.EncJSONMarshal(x)
1794 } else {
1795 yysep2 := !z.EncBinary()
1796 yy2arr2 := z.EncBasicHandle().StructToArray
1797 _, _ = yysep2, yy2arr2
1798 const yyr2 bool = false // struct tag has 'toArray'
1799 if yyr2 || yy2arr2 {
1800 r.WriteArrayStart(1)
1801 } else {
1802 r.WriteMapStart(1)
1803 }
1804 if yyr2 || yy2arr2 {
1805 r.WriteArrayElem()
1806 if false {
1807 } else {
1808 if z.EncBasicHandle().StringToRaw {
1809 r.EncodeStringBytesRaw(z.BytesView(string(x.Username)))
1810 } else {
1811 r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Username))
1812 }
1813 }
1814 } else {
1815 r.WriteMapElemKey()
1816 if z.IsJSONHandle() {
1817 z.WriteStr("\"Username\"")
1818 } else {
1819 r.EncodeStringEnc(codecSelferCcUTF86617, `Username`)
1820 }
1821 r.WriteMapElemValue()
1822 if false {
1823 } else {
1824 if z.EncBasicHandle().StringToRaw {
1825 r.EncodeStringBytesRaw(z.BytesView(string(x.Username)))
1826 } else {
1827 r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Username))
1828 }
1829 }
1830 }
1831 if yyr2 || yy2arr2 {
1832 r.WriteArrayEnd()
1833 } else {
1834 r.WriteMapEnd()
1835 }
1836 }
1837 }
1838}
1839

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected