| type readingSorter struct { |
| by func(r1, r2 ScanReading) bool |
| func (s *readingSorter) Len() int { |
| func (s *readingSorter) Swap(i, j int) { |
| s.readings[i], s.readings[j] = s.readings[j], s.readings[i] |
| func (s *readingSorter) Less(i, j int) bool { |
| return s.by(s.readings[i], s.readings[j]) |
| type deviceSorter struct { |
| by func(d1, d2 device) bool |
| func (s *deviceSorter) Len() int { |
| func (s *deviceSorter) Swap(i, j int) { |
| s.devices[i], s.devices[j] = s.devices[j], s.devices[i] |
| func (s *deviceSorter) Less(i, j int) bool { |
| return s.by(s.devices[i], s.devices[j]) |