This repository has been archived on 2022-03-09. You can view files and clone it, but cannot push or open issues or pull requests.
snoo2nebby/vendor/github.com/turnage/graw/streams/internal/rsort/sort.go

20 lines
473 B
Go

package rsort
type byCreationTime struct {
things []redditThing
}
func (b byCreationTime) Len() int { return len(b.things) }
// Returns true if things[i] should precede things[j], which is true if it is a
// younger redditThing (more recent creation time).
func (b byCreationTime) Less(i, j int) bool {
return b.things[i].Birth() > b.things[j].Birth()
}
func (b byCreationTime) Swap(i, j int) {
thing := b.things[i]
b.things[i] = b.things[j]
b.things[j] = thing
}