MCPcopy Create free account
hub / github.com/temporalio/temporal / mapKeyToString

Method mapKeyToString

chasm/tree.go:972–988  ·  view source on GitHub ↗
(keyV reflect.Value)

Source from the content-addressed store, hash-verified

970}
971
972func (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
990func (n *Node) stringToMapKey(nodeName string, key string, keyT reflect.Type) (reflect.Value, error) {
991 var (

Callers 1

syncSubComponentsMethod · 0.95

Calls 7

UnexpectedInternalErrFunction · 0.92
IntMethod · 0.80
KindMethod · 0.65
StringMethod · 0.65
BoolMethod · 0.65
TypeMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected