Files
VLoop/backend/internal/video/comment_entity.go
huanghaosheng c210e75996 style(backend): 清理幂等写入路径的注释
注释只保留一行级约束。
长段理由移入设计文档。
验证:go test -count=1 ./... 全绿。
2026-10-31 00:03:53 +08:00

32 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package video
import "time"
type Comment struct {
ID uint `gorm:"primaryKey" json:"id"`
Username string `gorm:"index" json:"username"`
VideoID uint `gorm:"index" json:"video_id"`
AuthorID uint `gorm:"index;uniqueIndex:uk_comments_author_key,priority:1" json:"author_id"`
Content string `gorm:"type:text" json:"content"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
// IdempotencyKey 必须是 *string:空串会互撞唯一索引,NULL 不会。
IdempotencyKey *string `gorm:"column:idempotency_key;type:varchar(64);uniqueIndex:uk_comments_author_key,priority:2" json:"-"`
}
type PublishCommentRequest struct {
VideoID uint `json:"video_id"`
Content string `json:"content"`
// RequestID 由客户端为一次发送动作生成,重试时复用;为空则服务端生成。
RequestID string `json:"request_id"`
}
type DeleteCommentRequest struct {
CommentID uint `json:"comment_id"`
}
type GetAllCommentsRequest struct {
VideoID uint `json:"video_id"`
}