feat(database): time in UTC
All checks were successful
Gitea Build Check / Build (push) Successful in 2m27s
Gitea Build Check / Build (pull_request) Successful in 2m33s

the time will now be saved in UTC
This commit is contained in:
SoXX 2024-08-29 14:34:40 +02:00
parent 150313f7d7
commit b3ebc23b09

View File

@ -4,6 +4,7 @@ import (
"context"
"embed"
"fmt"
"time"
"git.anthrove.art/Anthrove/otter-space-sdk/v3/internal/utils"
otterError "git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/error"
@ -65,6 +66,9 @@ func Connect(ctx context.Context, config models.DatabaseConfig) error {
dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=%s", config.Endpoint, config.Username, config.Password, config.Database, config.Port, localSSL, config.Timezone)
sqlDB, err := gorm.Open(postgres.Open(dsn), &gorm.Config{
TranslateError: true,
NowFunc: func() time.Time {
return time.Now().UTC()
},
})
if err != nil {
return utils.HandleError(ctx, span, localLogger, err)