MCPcopy Create free account
hub / github.com/gogs/gogs / GetCommentByID

Function GetCommentByID

internal/database/comment.go:412–421  ·  view source on GitHub ↗

GetCommentByID returns the comment by given ID.

(id int64)

Source from the content-addressed store, hash-verified

410
411// GetCommentByID returns the comment by given ID.
412func GetCommentByID(id int64) (*Comment, error) {
413 c := new(Comment)
414 has, err := x.Id(id).Get(c)
415 if err != nil {
416 return nil, err
417 } else if !has {
418 return nil, ErrCommentNotExist{args: map[string]any{"commentID": id}}
419 }
420 return c, c.LoadAttributes()
421}
422
423// FIXME: use CommentList to improve performance.
424func loadCommentsAttributes(e Engine, comments []*Comment) (err error) {

Callers 5

UpdateCommentContentFunction · 0.92
DeleteCommentFunction · 0.92
EditIssueCommentFunction · 0.92
DeleteIssueCommentFunction · 0.92
DeleteCommentByIDFunction · 0.85

Calls 2

GetMethod · 0.65
LoadAttributesMethod · 0.45

Tested by

no test coverage detected