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

Method CodecEncodeSelf

benchmark/benchmark_codecgen.go:1946–2021  ·  view source on GitHub ↗

Benchmark harness support for STK-REQ-004.

(e *codec1978.Encoder)

Source from the content-addressed store, hash-verified

1944
1945// Benchmark harness support for STK-REQ-004.
1946func (x *DSTopic) CodecEncodeSelf(e *codec1978.Encoder) {
1947 var h codecSelfer6617
1948 z, r := codec1978.GenHelperEncoder(e)
1949 _, _, _ = h, z, r
1950 if x == nil {
1951 r.EncodeNil()
1952 } else {
1953 if false {
1954 } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
1955 z.EncExtension(x, yyxt1)
1956 } else if !z.EncBinary() && z.IsJSONHandle() {
1957 z.EncJSONMarshal(x)
1958 } else {
1959 yysep2 := !z.EncBinary()
1960 yy2arr2 := z.EncBasicHandle().StructToArray
1961 _, _ = yysep2, yy2arr2
1962 const yyr2 bool = false // struct tag has 'toArray'
1963 if yyr2 || yy2arr2 {
1964 r.WriteArrayStart(2)
1965 } else {
1966 r.WriteMapStart(2)
1967 }
1968 if yyr2 || yy2arr2 {
1969 r.WriteArrayElem()
1970 if false {
1971 } else {
1972 r.EncodeInt(int64(x.Id))
1973 }
1974 } else {
1975 r.WriteMapElemKey()
1976 if z.IsJSONHandle() {
1977 z.WriteStr("\"Id\"")
1978 } else {
1979 r.EncodeStringEnc(codecSelferCcUTF86617, `Id`)
1980 }
1981 r.WriteMapElemValue()
1982 if false {
1983 } else {
1984 r.EncodeInt(int64(x.Id))
1985 }
1986 }
1987 if yyr2 || yy2arr2 {
1988 r.WriteArrayElem()
1989 if false {
1990 } else {
1991 if z.EncBasicHandle().StringToRaw {
1992 r.EncodeStringBytesRaw(z.BytesView(string(x.Slug)))
1993 } else {
1994 r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Slug))
1995 }
1996 }
1997 } else {
1998 r.WriteMapElemKey()
1999 if z.IsJSONHandle() {
2000 z.WriteStr("\"Slug\"")
2001 } else {
2002 r.EncodeStringEnc(codecSelferCcUTF86617, `Slug`)
2003 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected