joao/pkg/config/sort.go

25 lines
437 B
Go
Raw Permalink Normal View History

2022-12-20 05:49:37 +00:00
// Copyright © 2022 Roberto Hidalgo <joao@un.rob.mx>
2022-12-31 06:14:08 +00:00
// SPDX-License-Identifier: Apache-2.0
2022-12-20 05:49:37 +00:00
package config
type sortedMapEntry struct {
key *Entry
value *Entry
}
type smec struct {
smes []*sortedMapEntry
}
func (e smec) Len() int {
return len(e.smes)
}
func (e smec) Less(i, j int) bool {
return e.smes[i].value.Name() < e.smes[j].value.Name()
}
func (e smec) Swap(i, j int) {
e.smes[i], e.smes[j] = e.smes[j], e.smes[i]
}