MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / MarshalJSON

Method MarshalJSON

pkg/event/batch.go:35–51  ·  view source on GitHub ↗

MarshalJSON serializes the batch of events to JSON format.

()

Source from the content-addressed store, hash-verified

33
34// MarshalJSON serializes the batch of events to JSON format.
35func (b *Batch) MarshalJSON() []byte {
36 buf := make([]byte, 0)
37 buf = append(buf, '[')
38 for i, evt := range b.Events {
39 writeMore := true
40 if i == len(b.Events)-1 {
41 writeMore = false
42 }
43 buf = append(buf, evt.MarshalJSON()...)
44 buf = append(buf, '\n')
45 if writeMore {
46 buf = append(buf, ',')
47 }
48 }
49 buf = append(buf, ']')
50 return buf
51}

Callers 5

TestBatchMarshalJSONFunction · 0.95
PublishMethod · 0.45
PublishMethod · 0.45
PublishMethod · 0.45
newBulkIndexRequestFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestBatchMarshalJSONFunction · 0.76