(ctx context.Context, comment Comment)
| 80 | return comment, nil |
| 81 | } |
| 82 | func (c *commentDAO) UpdateComment(ctx context.Context, comment Comment) error { |
| 83 | // 确保更新的是指定 ID 的评论 |
| 84 | if err := c.db.WithContext(ctx).Model(&Comment{}).Where("id = ?", comment.Id).Updates(comment).Error; err != nil { |
| 85 | c.l.Error("更新评论失败", zap.Error(err)) |
| 86 | return err |
| 87 | } |
| 88 | return nil |
| 89 | } |
| 90 | |
| 91 | // DeleteCommentById 根据ID删除评论 |
| 92 | func (c *commentDAO) DeleteCommentById(ctx context.Context, commentId int64) error { |
nothing calls this directly
no outgoing calls
no test coverage detected