Merge branch 'main' of https://github.com/Poomipat-Ch/taobin_recipe_manager
This commit is contained in:
commit
96f341aa28
26 changed files with 1068 additions and 664 deletions
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue