You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
868 B

package models
import "time"
4 years ago
type Post struct {
4 years ago
ID int64 `json:"id"`
Creator *UserSimple `json:"creator"`
CreatorID int64 `json:"creatorId"`
Title string `json:"title"`
Slug string `json:"slug"`
Md string `json:"md"`
URL string `json:"url"`
Cover string `json:"cover"`
Brief string `json:"brief"`
Tags []int64 `json:"tags"`
Likes int `json:"likes"`
Liked bool `json:"liked"`
Recommands int `json:"recommands"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
4 years ago
type Posts []*Post
4 years ago
func (ar Posts) Len() int { return len(ar) }
func (ar Posts) Swap(i, j int) { ar[i], ar[j] = ar[j], ar[i] }
func (ar Posts) Less(i, j int) bool {
return ar[i].Created.Unix() > ar[j].Created.Unix()
}