2018-04-29 19:56:37 +00:00
|
|
|
package events
|
|
|
|
|
|
|
|
// ByDate sorts events by their start time.
|
|
|
|
type ByDate []*Event
|
|
|
|
|
|
|
|
func (a ByDate) Len() int { return len(a) }
|
|
|
|
func (a ByDate) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
|
|
func (a ByDate) Less(i, j int) bool {
|
2018-05-01 00:50:39 +00:00
|
|
|
return a[i].StartTime.Before(a[j].StartTime) || a[i].ID < a[j].ID
|
2018-04-29 19:56:37 +00:00
|
|
|
}
|