16 lines
398 B
Go
16 lines
398 B
Go
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] }
|