MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / UpdateComment

Method UpdateComment

internal/repository/dao/comment.go:82–89  ·  view source on GitHub ↗
(ctx context.Context, comment Comment)

Source from the content-addressed store, hash-verified

80 return comment, nil
81}
82func (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删除评论
92func (c *commentDAO) DeleteCommentById(ctx context.Context, commentId int64) error {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected