soccer-bot/sort.go

17 lines
363 B
Go
Raw Normal View History

2017-08-08 16:32:45 +00:00
package main
import "github.com/icedream/go-footballdata"
type timeSortedMatches []*footballdata.Fixture
func (slice timeSortedMatches) Len() int {
return len(slice)
}
func (slice timeSortedMatches) Less(i, j int) bool {
return slice[i].Date.Before(slice[j].Date)
}
func (slice timeSortedMatches) Swap(i, j int) {
slice[i], slice[j] = slice[j], slice[i]
}