feat: added more utilities functions

This commit is contained in:
2024-11-03 20:57:03 +01:00
parent c90eedf430
commit 16b74bb80d
10 changed files with 542 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
package utils
import (
"fmt"
"log/slog"
"time"
)
func CorrectTimezone(timeStamp time.Time) time.Time {
loc, _ := time.LoadLocation("Europe/Madrid")
return timeStamp.In(loc)
}
func GetBool(value string) bool {
return value == "true"
}
func LogAndReturnError(err error, message string) error {
slog.Error(message, "error", err.Error())
return fmt.Errorf("%s: %w", message, err)
}