gitlab.com/evatix-go/core@v1.3.55/coreimpl/enumimpl/toStringsSliceOfDiffMap.go (about)

     1  package enumimpl
     2  
     3  import "strconv"
     4  
     5  func toStringsSliceOfDiffMap(diffMap DynamicMap) (diffSlice []string) {
     6  	isString := diffMap.IsValueString()
     7  	isNumber := !isString
     8  	slice := make([]string, diffMap.Length())
     9  
    10  	if isNumber {
    11  		sortedKeyValueIntegers := diffMap.SortedKeyValues()
    12  		for index, keyValInteger := range sortedKeyValueIntegers {
    13  			valueString := strconv.Itoa(keyValInteger.ValueInteger)
    14  			line := keyValInteger.WrapKey() + ":" + valueString
    15  			slice[index] = line
    16  		}
    17  
    18  		return slice
    19  	}
    20  
    21  	sortedKeysAnyValues := diffMap.SortedKeyAnyValues()
    22  
    23  	for index, anyKeyVal := range sortedKeysAnyValues {
    24  		line := anyKeyVal.WrapKey() + ":" +
    25  			anyKeyVal.WrapValue()
    26  		slice[index] = line
    27  	}
    28  
    29  	return slice
    30  }