friends/database/3ds/update_user_profile.go
2024-04-27 16:22:30 -04:00

26 lines
690 B
Go

package database_3ds
import (
"github.com/PretendoNetwork/friends/database"
friends_3ds_types "github.com/PretendoNetwork/nex-protocols-go/v2/friends-3ds/types"
)
// UpdateUserProfile updates a user's profile
func UpdateUserProfile(pid uint32, profileData *friends_3ds_types.MyProfile) error {
_, err := database.Manager.Exec(`
INSERT INTO "3ds".user_data (pid, region, area, language, country)
VALUES ($1, $2, $3, $4, $5)
ON CONFLICT (pid)
DO UPDATE SET
region = $2,
area = $3,
language = $4,
country = $5`, pid, profileData.Region.Value, profileData.Area.Value, profileData.Language.Value, profileData.Country.Value)
if err != nil {
return err
}
return nil
}