(v reflect.Value)
| 83 | } |
| 84 | |
| 85 | func encodeMCPReflectMap(v reflect.Value) map[string]any { |
| 86 | result := make(map[string]any, v.Len()) |
| 87 | iter := v.MapRange() |
| 88 | for iter.Next() { |
| 89 | key := iter.Key() |
| 90 | keyString := mapKeyToString(key) |
| 91 | if keyString == "" { |
| 92 | continue |
| 93 | } |
| 94 | value := iter.Value().Interface() |
| 95 | if isMCPIDField(keyString) { |
| 96 | if encodedValue, ok := encodeMCPIDValue(value); ok { |
| 97 | result[keyString] = encodedValue |
| 98 | continue |
| 99 | } |
| 100 | if encodedValues, ok := encodeMCPIDSlice(value); ok { |
| 101 | result[keyString] = encodedValues |
| 102 | continue |
| 103 | } |
| 104 | } |
| 105 | result[keyString] = encodeMCPValue(value) |
| 106 | } |
| 107 | return result |
| 108 | } |
| 109 | |
| 110 | func mapKeyToString(key reflect.Value) string { |
| 111 | if !key.IsValid() { |
no test coverage detected