MCPcopy
hub / github.com/elastic/go-elasticsearch / EncodeJSON

Method EncodeJSON

esutil/json_reader_benchmark_test.go:40–51  ·  view source on GitHub ↗
(w io.Writer)

Source from the content-addressed store, hash-verified

38}
39
40func (f Foo) EncodeJSON(w io.Writer) error {
41 var b bytes.Buffer
42 b.WriteString(`{"bar":"`)
43 b.WriteString(strings.ToUpper(f.Bar))
44 b.WriteString(`"}`)
45 b.WriteString("\n")
46 _, err := b.WriteTo(w)
47 if err != nil {
48 return err
49 }
50 return nil
51}
52
53func BenchmarkJSONReader(b *testing.B) {
54 b.ReportAllocs()

Callers

nothing calls this directly

Calls 1

WriteToMethod · 0.80

Tested by

no test coverage detected