Refactor search

This commit is contained in:
2025-09-08 18:15:43 +08:00
parent 62d10a989d
commit d1da0dc948
7 changed files with 504 additions and 183 deletions

View File

@@ -2,10 +2,11 @@ package dao
import (
"errors"
"github.com/gofiber/fiber/v3/log"
"nysoure/server/model"
"strings"
"github.com/gofiber/fiber/v3/log"
"gorm.io/gorm"
)
@@ -171,3 +172,11 @@ func ClearUnusedTags() error {
}
return nil
}
func ExistsTag(name string) (bool, error) {
var count int64
if err := db.Model(&model.Tag{}).Where("name = ?", name).Count(&count).Error; err != nil {
return false, err
}
return count > 0, nil
}