nestedMapSet sets a value in a nested map[string]any structure. If the key has more than one element, it creates nested maps as needed.
(m map[string]any, key string, value any)
| 379 | // nestedMapSet sets a value in a nested map[string]any structure. |
| 380 | // If the key has more than one element, it creates nested maps as needed. |
| 381 | func nestedMapSet(m map[string]any, key string, value any) { |
| 382 | key, rest, isGroup := strings.Cut(key, ".") |
| 383 | |
| 384 | if !isGroup { |
| 385 | m[key] = value |
| 386 | return |
| 387 | } |
| 388 | |
| 389 | mm, ok := m[key].(map[string]any) |
| 390 | if !ok { |
| 391 | mm = make(map[string]any) |
| 392 | } |
| 393 | |
| 394 | nestedMapSet(mm, rest, value) |
| 395 | |
| 396 | m[key] = mm |
| 397 | } |
| 398 | |
| 399 | func toSlogValue(v any) slog.Value { |
| 400 | m, ok := v.(map[string]any) |