types.go (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
package main import ( "time" ) type Config struct { FeedFile string FeedAscend bool FriendsFile string MaxPosts int64 Nick string } type FeedEntry struct { Nick string Timestamp time.Time Post string } type Feed []FeedEntry func (self Feed) Len() int { return len(self) } func (self Feed) Swap(i, j int) { self[i], self[j] = self[j], self[i] } func (self Feed) Less(i, j int) bool { return self[i].Timestamp.After(self[j].Timestamp) } |