Function
readString
(properties map[string]any, key ...string)
Source from the content-addressed store, hash-verified
| 415 | } |
| 416 | |
| 417 | func readString(properties map[string]any, key ...string) string { |
| 418 | for i, k := range key { |
| 419 | v, ok := properties[k] |
| 420 | if !ok { |
| 421 | return "" |
| 422 | } |
| 423 | if i < len(key)-1 { |
| 424 | properties, ok = v.(map[string]any) |
| 425 | if !ok { |
| 426 | return "" |
| 427 | } |
| 428 | continue |
| 429 | } |
| 430 | switch v := v.(type) { |
| 431 | case string: |
| 432 | return v |
| 433 | case fmt.Stringer: |
| 434 | return v.String() |
| 435 | case []byte: |
| 436 | return string(v) |
| 437 | } |
| 438 | } |
| 439 | return "" |
| 440 | } |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…