func (mgr *manager) UpdateUser(user User) (User, error) {
	user.UpdatedAt = time.Now().Unix()
	result := mgr.db.Clauses(
		clause.OnConflict{
			UpdateAll: true,
			Columns:   []clause.Column{{Name: "email"}},
		}).Create(&user)
	if result.Error != nil {
		log.Println(result.Error)
		return user, result.Error
	}
	return user, nil
}
UpdateUser function to update user with ID conflict
package db
import (
	"log"
	"time"
	"github.com/google/uuid"
	"gorm.io/gorm"
	"gorm.io/gorm/clause"
)
type User struct {
	ID              uuid.UUID `gorm:"type:uuid;"`
	FirstName       string
	LastName        string
	Email           string `gorm:"unique"`
	Password        string
	SignupMethod    string
	EmailVerifiedAt int64
	CreatedAt       int64 `gorm:"autoCreateTime"`
	UpdatedAt       int64 `gorm:"autoUpdateTime"`
	Image           string
	Roles           string
}
func (u *User) BeforeCreate(tx *gorm.DB) (err error) {
	u.ID = uuid.New()
	return
}
func (mgr *manager) SaveUser(user User) (User, error) {
	result := mgr.db.Clauses(
		clause.OnConflict{
			UpdateAll: true,
			Columns:   []clause.Column{{Name: "email"}},
		}).Create(&user)
	if result.Error != nil {
		log.Println(result.Error)
		return user, result.Error
	}
	return user, nil
}