GetCommentByID returns the comment by given ID.
(id int64)
| 410 | |
| 411 | // GetCommentByID returns the comment by given ID. |
| 412 | func 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. |
| 424 | func loadCommentsAttributes(e Engine, comments []*Comment) (err error) { |
no test coverage detected