parcoursmob/utils/sorting/groups.go

16 lines
398 B
Go
Raw Permalink Normal View History

2022-11-01 10:32:13 +00:00
package sorting
import (
"strings"
groupstorage "git.coopgo.io/coopgo-platform/groups-management/storage"
)
type GroupsByName []groupstorage.Group
func (a GroupsByName) Len() int { return len(a) }
func (a GroupsByName) Less(i, j int) bool {
return strings.Compare(a[i].Data["name"].(string), a[j].Data["name"].(string)) < 0
}
func (a GroupsByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }