[优化] 代码优化

This commit is contained in:
ryan
2026-05-31 13:37:40 +08:00
parent c2fcd2eddf
commit 8894620b92
12 changed files with 125 additions and 57 deletions
+8
View File
@@ -11,6 +11,7 @@ import (
"openflare/utils/security"
"os"
"reflect"
"strings"
"sync"
)
@@ -313,3 +314,10 @@ func CloseDB() error {
err = sqlDB.Close()
return err
}
func IsUniqueConstraintError(err error) bool {
if err == nil {
return false
}
return strings.Contains(strings.ToLower(err.Error()), "unique")
}