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

Function GetMapKeys

utils/map_keys.go:29–37  ·  view source on GitHub ↗

GetMapKeys returns the map's keys as an unsorted slice.

(m map[K]V)

Source from the content-addressed store, hash-verified

27
28// GetMapKeys returns the map's keys as an unsorted slice.
29func GetMapKeys[K comparable, V any](m map[K]V) []K {
30 allKeys := make([]K, len(m))
31 i := 0
32 for k := range m {
33 allKeys[i] = k
34 i++
35 }
36 return allKeys
37}
38
39// GetMapKeysSorted returns the map's keys as a sorted slice. The keys are sorted in ascending order. For descending
40// order, use GetMapKeysSortedDescending.

Callers 3

ConvertToJsonDocumentFunction · 0.92
GetMapKeysSortedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected