| 644 | } |
| 645 | |
| 646 | func InterfaceToInterfaceInterfaceMap(in interface{}) (map[interface{}]interface{}, bool) { |
| 647 | if in == nil { |
| 648 | return nil, true |
| 649 | } |
| 650 | |
| 651 | if inMap, ok := in.(map[interface{}]interface{}); ok { |
| 652 | return inMap, true |
| 653 | } |
| 654 | |
| 655 | if reflect.TypeOf(in).Kind() != reflect.Map { |
| 656 | return nil, false |
| 657 | } |
| 658 | |
| 659 | inVal := reflect.ValueOf(in) |
| 660 | if inVal.IsNil() { |
| 661 | return nil, true |
| 662 | } |
| 663 | |
| 664 | out := make(map[interface{}]interface{}, inVal.Len()) |
| 665 | for _, key := range inVal.MapKeys() { |
| 666 | out[key.Interface()] = inVal.MapIndex(key).Interface() |
| 667 | } |
| 668 | return out, true |
| 669 | } |
| 670 | |
| 671 | func InterfaceToStrInterfaceMap(in interface{}) (map[string]interface{}, bool) { |
| 672 | if in == nil { |