Versions in this module Expand all Collapse all v0 v0.0.2 Oct 31, 2024 v0.0.1 Jul 13, 2022 Changes in this version + var DB *gorm.DB + func CountComment() int + func CountPage() int + func CountPost() int + func CountPostByArchive(year, month string) (count int, err error) + func CountPostByTag(tag string) (count int, err error) + func CountSubscriber() (int, error) + func CountTag() int + func DeletePostTagByPostId(postId uint) error + func InitDB() (*gorm.DB, error) + func SetAllCommentRead() error + type BaseModel struct + CreatedAt time.Time + ID uint + UpdatedAt time.Time + type Comment struct + AvatarUrl string + Content string + GithubUrl string + NickName string + PostID uint + ReadState bool + UserID uint + func ListCommentByPostID(postId string) ([]*Comment, error) + func ListUnreadComment() ([]*Comment, error) + func MustListUnreadComment() []*Comment + func (comment *Comment) Delete() error + func (comment *Comment) Insert() error + func (comment *Comment) Update() error + type Link struct + Name string + Sort int + Url string + View int + func GetLinkById(id uint) (*Link, error) + func ListLinks() ([]*Link, error) + func MustListLinks() []*Link + func (link *Link) Delete() error + func (link *Link) Insert() error + func (link *Link) Update() error + type Page struct + Body string + IsPublished bool + Title string + View int + func GetPageById(id string) (*Page, error) + func ListAllPage() ([]*Page, error) + func ListPublishedPage() ([]*Page, error) + func (page *Page) Delete() error + func (page *Page) Insert() error + func (page *Page) Update() error + func (page *Page) UpdateView() error + type Post struct + Body string + CommentTotal int + Comments []*Comment + IsPublished bool + Tags []*Tag + Title string + View int + func GetPostById(id string) (*Post, error) + func ListAllPost(tag string) ([]*Post, error) + func ListMaxCommentPost() (posts []*Post, err error) + func ListMaxReadPost() (posts []*Post, err error) + func ListPostByArchive(year, month string, pageIndex, pageSize int) ([]*Post, error) + func ListPublishedPost(tag string, pageIndex, pageSize int) ([]*Post, error) + func MustListMaxCommentPost() (posts []*Post) + func MustListMaxReadPost() (posts []*Post) + func (post *Post) Delete() error + func (post *Post) Excerpt() template.HTML + func (post *Post) Insert() error + func (post *Post) Update() error + func (post *Post) UpdateView() error + type PostTag struct + PostId uint + TagId uint + func (pt *PostTag) Insert() error + type QrArchive struct + ArchiveDate time.Time + Month int + Total int + Year int + func ListPostArchives() ([]*QrArchive, error) + func MustListPostArchives() []*QrArchive + type SmmsFile struct + Delete string + FileName string + Hash string + Height int + Path string + Size int + StoreName string + Url string + Width int + func (sf SmmsFile) Insert() (err error) + type Subscriber struct + Email string + OutTime time.Time + SecretKey string + Signature string + SubscribeState bool + VerifyState bool + func GetSubscriberByEmail(mail string) (*Subscriber, error) + func GetSubscriberById(id uint) (*Subscriber, error) + func GetSubscriberBySignature(key string) (*Subscriber, error) + func ListSubscriber(invalid bool) ([]*Subscriber, error) + func (s *Subscriber) Insert() error + func (s *Subscriber) Update() error + type Tag struct + Name string + Total int + func ListAllTag() ([]*Tag, error) + func ListTag() ([]*Tag, error) + func ListTagByPostId(id string) ([]*Tag, error) + func MustListTag() []*Tag + func (tag *Tag) Insert() error + type User struct + AvatarUrl string + Email string + GithubLoginId string + GithubUrl string + IsAdmin bool + LockState bool + NickName string + OutTime time.Time + Password string + SecretKey string + Telephone string + VerifyState string + func GetUser(id interface{}) (*User, error) + func GetUserByUsername(username string) (*User, error) + func IsGithubIdExists(githubId string, id uint) (*User, error) + func ListUsers() ([]*User, error) + func (user *User) FirstOrCreate() (*User, error) + func (user *User) Insert() error + func (user *User) Lock() error + func (user *User) Update() error + func (user *User) UpdateEmail(email string) error + func (user *User) UpdateGithubUserInfo() error + func (user *User) UpdateProfile(avatarUrl, nickName string) error