MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / pairsToMap

Function pairsToMap

pkg/log/fields.go:59–73  ·  view source on GitHub ↗
(pairs ...any)

Source from the content-addressed store, hash-verified

57}
58
59func pairsToMap(pairs ...any) map[string]any {
60 if len(pairs)%2 != 0 {
61 panic("Uneven number of key-value pairs passed")
62 }
63 nodes := make(map[string]any)
64 var key string
65 for i, node := range pairs {
66 if i%2 == 0 {
67 key = fmt.Sprintf("%v", node)
68 } else {
69 nodes[key] = node
70 }
71 }
72 return nodes
73}
74
75// Fields implements Fielder. Returns all fields in O(n), where n is the number of entries in the map.
76func (f *F) Fields() map[string]any {

Callers 1

FieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected