mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
Add comment functionality.
This commit is contained in:
@@ -167,3 +167,14 @@ func GetResourceByTag(tagID uint, page int, pageSize int) ([]model.Resource, int
|
||||
|
||||
return tag.Resources, totalPages, nil
|
||||
}
|
||||
|
||||
func ExistsResource(id uint) (bool, error) {
|
||||
var r model.Resource
|
||||
if err := db.Model(&model.Resource{}).Where("id = ?", id).First(&r).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user