MCPcopy Create free account
hub / github.com/coder/slog / marshalList

Function marshalList

map.go:57–71  ·  view source on GitHub ↗
(rv reflect.Value)

Source from the content-addressed store, hash-verified

55}
56
57func marshalList(rv reflect.Value) []byte {
58 b := &bytes.Buffer{}
59 b.WriteByte('[')
60 for i := 0; i < rv.Len(); i++ {
61 b.WriteByte('\n')
62 b.Write(encode(rv.Index(i).Interface()))
63
64 if i < rv.Len()-1 {
65 b.WriteByte(',')
66 }
67 }
68 b.WriteByte(']')
69
70 return b.Bytes()
71}
72
73func encode(v interface{}) []byte {
74 if vr, ok := v.(driver.Valuer); ok {

Callers 1

encodeFunction · 0.85

Calls 2

encodeFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected