This commit is contained in:
pakintada@gmail.com 2023-12-07 11:09:20 +07:00
commit 96f341aa28
26 changed files with 1068 additions and 664 deletions

View file

@ -3,15 +3,8 @@ package helpers
import (
"fmt"
"os"
"recipe-manager/services/logger"
"strconv"
"strings"
"go.uber.org/zap"
)
var (
Log = logger.GetInstance()
)
// DynamicCompare compares two values dynamically and returns true if they are equal.
@ -101,13 +94,13 @@ func GetTempFile(filename string, user string, suffix int) string {
if os.IsNotExist(err) {
// Create temp file
if suffix == 0 {
Log.Debug("[helpers] Suffix 0 GetTempFile", zap.Any("filename", filename))
return strings.Replace(filename, ".json", "_"+user+".tmp"+strconv.Itoa(suffix), 1)
}
// change extension from json to tmp
filename = strings.Replace(filename, ".json", "_"+user+".tmp"+strconv.Itoa(suffix), 1)
Log.Debug("[helpers] GetTempFile", zap.Any("filename", filename))
return filename
} else {