mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-13 08:28:22 +08:00
Go: refactor UUID functions (#16695)
As title --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -25,11 +25,10 @@ import (
|
||||
"ragflow/internal/dao"
|
||||
"ragflow/internal/entity"
|
||||
"ragflow/internal/storage"
|
||||
"ragflow/internal/utility"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -65,7 +64,7 @@ func (s *FileCommitService) CreateCommit(folderID, authorID, message string, cha
|
||||
}
|
||||
|
||||
// 3. Create commit record
|
||||
commitID := generateCommitUUID()
|
||||
commitID := utility.GenerateUUID()
|
||||
nowMs := time.Now().UnixMilli()
|
||||
|
||||
commit := &entity.FileCommit{
|
||||
@@ -105,7 +104,7 @@ func (s *FileCommitService) CreateCommit(folderID, authorID, message string, cha
|
||||
|
||||
for _, change := range changes {
|
||||
item := &entity.FileCommitItem{
|
||||
ID: generateCommitUUID(),
|
||||
ID: utility.GenerateUUID(),
|
||||
CommitID: commitID,
|
||||
FileID: change.FileID,
|
||||
Operation: change.Operation,
|
||||
@@ -629,9 +628,3 @@ func computeLiveFileHash(folderID, fileID string, file *entity.File) string {
|
||||
hash := sha256.Sum256(data)
|
||||
return hex.EncodeToString(hash[:])
|
||||
}
|
||||
|
||||
// generateCommitUUID generates a UUID without dashes
|
||||
func generateCommitUUID() string {
|
||||
id := uuid.New().String()
|
||||
return strings.ReplaceAll(id, "-", "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user