(keyV reflect.Value)
| 970 | } |
| 971 | |
| 972 | func (n *Node) mapKeyToString(keyV reflect.Value) (string, error) { |
| 973 | switch keyV.Kind() { |
| 974 | case reflect.String: |
| 975 | return keyV.String(), nil |
| 976 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: |
| 977 | return strconv.FormatInt(keyV.Int(), 10), nil |
| 978 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: |
| 979 | return strconv.FormatUint(keyV.Uint(), 10), nil |
| 980 | case reflect.Bool: |
| 981 | return strconv.FormatBool(keyV.Bool()), nil |
| 982 | default: |
| 983 | return "", softassert.UnexpectedInternalErr( |
| 984 | n.logger, |
| 985 | "CHASM map key type is not supported", |
| 986 | fmt.Errorf("node %s must be one of [%s], got %s", n.nodeName, mapKeyTypes, keyV.Type().String())) |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | func (n *Node) stringToMapKey(nodeName string, key string, keyT reflect.Type) (reflect.Value, error) { |
| 991 | var ( |
no test coverage detected