2024-08-09 15:00:52 +00:00
|
|
|
package builder
|
2024-08-09 14:14:42 +00:00
|
|
|
|
|
|
|
import "sort"
|
|
|
|
|
2024-08-09 15:06:15 +00:00
|
|
|
func AggregateSortedKeys(maps []Map) []string {
|
2024-08-09 14:14:42 +00:00
|
|
|
set := make(map[string]int)
|
|
|
|
keys := make([]string, 0)
|
|
|
|
for _, item := range maps {
|
|
|
|
for k := range item {
|
|
|
|
if set[k] == 1 {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
keys = append(keys, k)
|
|
|
|
set[k] = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set = nil
|
|
|
|
sort.Strings(keys)
|
|
|
|
return keys
|
|
|
|
}
|