MCPcopy Create free account
hub / github.com/dolthub/doltgresql / GetMapKeysSorted

Function GetMapKeysSorted

utils/map_keys.go:41–47  ·  view source on GitHub ↗

GetMapKeysSorted returns the map's keys as a sorted slice. The keys are sorted in ascending order. For descending order, use GetMapKeysSortedDescending.

(m map[K]V)

Source from the content-addressed store, hash-verified

39// GetMapKeysSorted returns the map's keys as a sorted slice. The keys are sorted in ascending order. For descending
40// order, use GetMapKeysSortedDescending.
41func GetMapKeysSorted[K cmp.Ordered, V any](m map[K]V) []K {
42 allKeys := GetMapKeys(m)
43 sort.Slice(allKeys, func(i, j int) bool {
44 return allKeys[i] < allKeys[j]
45 })
46 return allKeys
47}
48
49// GetMapKeysSortedDescending returns the map's keys as a sorted slice. The keys are sorted in descending order. For
50// ascending order, use GetMapKeysSorted.

Callers 1

GetTableNamesMethod · 0.92

Calls 1

GetMapKeysFunction · 0.85

Tested by

no test coverage detected