1
0
mirror of https://github.com/lxc/incus.git synced 2026-02-05 09:46:19 +01:00
Files
incus/shared/idmap/set_sort.go
Stéphane Graber 8634fe3f08 shared/idmap: Introduce set_sort
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-01-05 21:30:45 -05:00

17 lines
327 B
Go

package idmap
// ByHostID allows for sorting an Set by host id.
type ByHostID Set
func (s ByHostID) Len() int {
return len(s.Entries)
}
func (s ByHostID) Swap(i, j int) {
s.Entries[i], s.Entries[j] = s.Entries[j], s.Entries[i]
}
func (s ByHostID) Less(i, j int) bool {
return s.Entries[i].HostID < s.Entries[j].HostID
}