Exists 检查点赞记录是否存在
()
| 89 | |
| 90 | // Exists 检查点赞记录是否存在 |
| 91 | func (l *Like) Exists() (bool, error) { |
| 92 | var count int64 |
| 93 | err := DB.Model(&Like{}). |
| 94 | Where("user_id = ? AND type = ? AND object_id = ?", l.UserID, l.Type, l.ObjectID). |
| 95 | Count(&count).Error |
| 96 | return count > 0, err |
| 97 | } |
| 98 | |
| 99 | // GetLikeByID 根据ID获取点赞记录 |
| 100 | func GetLikeByID(likeID int64) (*Like, error) { |
no outgoing calls
no test coverage detected