Documentation
¶
Index ¶
- func DecrementUserReply(articleId, userId uint64) error
- func FixStat(articleId, userId uint64, count uint32, lastReplyAt time.Time) error
- func IncrementUserReply(articleId, userId uint64) error
- func SaveOrCreateById(entity *Entity) int64
- func SyncArticlePosters(articleId uint64) []uint64
- type Entity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecrementUserReply ¶
DecrementUserReply 减少评论计数 (用于删除评论)
func IncrementUserReply ¶
IncrementUserReply 增加评论计数
func SaveOrCreateById ¶
func SyncArticlePosters ¶
SyncArticlePosters 重新计算并刷新文章表的头像 JSON
Types ¶
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"`
// 联合唯一索引 idx_article_user 用于 Upsert (On Conflict) 定位
// 联合索引 idx_active_query 用于高性能获取前 5 名活跃用户
ArticleId uint64 `` /* 145-byte string literal not displayed */
UserId uint64 `gorm:"column:user_id;type:bigint unsigned;not null;uniqueIndex:idx_article_user,priority:2" json:"userId"`
// 计数器和时间,用于排序
ReplyCount uint32 `gorm:"column:reply_count;type:int unsigned;not null;default:0;index:idx_active_query,priority:2" json:"replyCount"`
LastReplyAt time.Time `` /* 129-byte string literal not displayed */
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;<-:create;" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
}
Click to show internal directories.
Click to hide internal directories.