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.
feat: tag change unique id generate func
LinkinStar1b206b426094
diff --git a/internal/repo/tag/tag_repo.go b/internal/repo/tag/tag_repo.goindex 5243402e..bb0f3ad8 100644--- a/internal/repo/tag/tag_repo.go+++ b/internal/repo/tag/tag_repo.go@@ -2,7 +2,6 @@ package tagimport ("context"- "fmt""github.com/answerdev/answer/internal/base/data""github.com/answerdev/answer/internal/base/pager"@@ -34,12 +33,11 @@ func NewTagRepo(// AddTagList add tagfunc (tr *tagRepo) AddTagList(ctx context.Context, tagList []*entity.Tag) (err error) {for _, item := range tagList {- ID, err := tr.uniqueIDRepo.GenUniqueID(ctx, item.TableName())+ item.ID, err = tr.uniqueIDRepo.GenUniqueIDStr(ctx, item.TableName())if err != nil {return err}item.RevisionID = "0"- item.ID = fmt.Sprintf("%d", ID)}_, err = tr.data.DB.Insert(tagList)if err != nil {diff --git a/internal/repo/unique/uniqid_repo.go b/internal/repo/unique/uniqid_repo.goindex 44a9c0fa..5af8e028 100644--- a/internal/repo/unique/uniqid_repo.go+++ b/internal/repo/unique/uniqid_repo.go@@ -40,6 +40,7 @@ func (ur *uniqueIDRepo) GenUniqueID(ctx context.Context, key string) (uniqueID i}// GenUniqueIDStr generate unique id string+// 1 + 00x(objectType) + 000000000000x(id)func (ur *uniqueIDRepo) GenUniqueIDStr(ctx context.Context, key string) (uniqueID string, err error) {objectType := constant.ObjectTypeStrMapping[key]bean := &entity.Uniqid{UniqidType: objectType}