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

37 lines
1.1 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 (
"context"
)
// Mention 是一条待写入的提及通知。
type Mention struct {
RecipientID uint
SenderID uint
TargetID uint
Content string
DedupeKey string
}
type CommentStore interface {
// CreateIdempotentWithPopularity 在同一事务内插入评论并给热度加 delta。
// created=false 表示该意图已落库,调用方不得再加热度。
CreateIdempotentWithPopularity(ctx context.Context, c *Comment, delta int64) (created bool, err error)
GetByID(ctx context.Context, id uint) (*Comment, error)
DeleteComment(ctx context.Context, comment *Comment) error
DeleteByID(ctx context.Context, id uint) (deleted bool, err error)
GetAllComments(ctx context.Context, videoID uint) ([]Comment, error)
CreateMentions(ctx context.Context, mentions []Mention) error
FindAccountIDs(ctx context.Context, usernames []string) (map[string]uint, error)
}
// nilIfEmpty 供可空唯一列使用:空串会互撞,NULL 才是"没有这个键"。
func nilIfEmpty(s string) *string {
if s == "" {
return nil
}
return &s
}