Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: tag get list sql grammatical mistake

LinkinStarc0feb1d5730e
diff --git a/internal/repo/tag/tag_repo.go b/internal/repo/tag/tag_repo.go
index a9c8699d..8478cf2c 100644
--- a/internal/repo/tag/tag_repo.go
+++ b/internal/repo/tag/tag_repo.go
@@ -75,7 +75,7 @@ func (tr *tagRepo) GetTagBySlugName(ctx context.Context, slugName string) (tagIn
// GetTagListByName get tag list all like name
func (tr *tagRepo) GetTagListByName(ctx context.Context, name string, limit int) (tagList []*entity.Tag, err error) {
tagList = make([]*entity.Tag, 0)
- session := tr.data.DB.Where("LIKE ?", name+"%")
+ session := tr.data.DB.Where("slug_name LIKE ?", name+"%")
session.Where(builder.Eq{"status": entity.TagStatusAvailable})
session.Limit(limit).Asc("slug_name")
err = session.Find(&tagList)