Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "html/template"
- "time"
- )
- // Item is RSS entry which goes to template rendering
- type Item struct {
- Author string
- Title string
- Link string
- Date time.Time
- Content template.HTML
- }
- // ItemSlice is slice of Item type implementing Sort interface
- type ItemSlice []Item
- func (its ItemSlice) Len() int {
- return len(its)
- }
- func (its ItemSlice) Less(i, j int) bool {
- return its[j].Date.Before(its[i].Date)
- }
- func (its ItemSlice) Swap(i, j int) {
- its[i], its[j] = its[j], its[i]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement