MCPcopy
hub / github.com/rs/zerolog / CreateArray

Method CreateArray

event.go:216–224  ·  view source on GitHub ↗

CreateArray creates an Array to be used with the *Event.Array method. It preserves the stack, hooks, and context from the parent event. Call usual field methods like Str, Int etc to add elements to this array and give it as argument the *Event.Array method.

()

Source from the content-addressed store, hash-verified

214// Call usual field methods like Str, Int etc to add elements to this
215// array and give it as argument the *Event.Array method.
216func (e *Event) CreateArray() *Array {
217 a := Arr()
218 if e != nil {
219 a.stack = e.stack
220 a.ctx = e.ctx
221 a.ch = e.ch
222 }
223 return a
224}
225
226// Array adds the field key with an array to the event context.
227// Use e.CreateArray() to create the array or pass a type that

Callers 7

ArrayMethod · 0.95
ErrsMethod · 0.95
TestEvent_WithNilEventFunction · 0.95
ExampleEvent_ArrayFunction · 0.45
ExampleContext_ArrayFunction · 0.45
ExampleEvent_ArrayFunction · 0.45
ExampleContext_ArrayFunction · 0.45

Calls 1

ArrFunction · 0.85

Tested by 5

TestEvent_WithNilEventFunction · 0.76
ExampleEvent_ArrayFunction · 0.36
ExampleContext_ArrayFunction · 0.36
ExampleEvent_ArrayFunction · 0.36
ExampleContext_ArrayFunction · 0.36