refactor: eiblog

This commit is contained in:
deepzz0
2021-04-26 15:51:16 +08:00
parent bd69c62254
commit 68e01cdf1f
843 changed files with 3606 additions and 1007377 deletions

23
pkg/model/archive.go Normal file
View File

@@ -0,0 +1,23 @@
// Package model provides ...
package model
import "time"
// Archive 归档
type Archive struct {
Time time.Time
Articles SortedArticles `gorm:"-" bson:"-"` // 归档下的文章
}
// SortedArchives 排序后的归档
type SortedArchives []*Archive
// Len 长度
func (s SortedArchives) Len() int { return len(s) }
// Less 比较
func (s SortedArchives) Less(i, j int) bool { return s[i].Time.After(s[j].Time) }
// Swap 交换
func (s SortedArchives) Swap(i, j int) { s[i], s[j] = s[j], s[i] }