GORM Playground Link

https://github.com/go-gorm/playground/pull/490

Description

The goal is to change the time.Time to another object. It works great during the Create scenario, but during a Save, I would expect the object to flow properly down the SQL handler and call the driver.Valuer. But in this case, I can't make it keep the correct type.

In the playground I made it fail by looking at the type. But basically it failed during the SET, but would fail in a ON CONCLICT as well. For instance this: https://github.com/go-gorm/gorm/blob/ea8509b77704b152380f8097c59e5ae3b57428bb/callbacks/create.go#L307-L317

Is a different path taken during the Create https://github.com/go-gorm/gorm/blob/ea8509b77704b152380f8097c59e5ae3b57428bb/schema/field.go#L890

Then in the driver callValuerValue, the correct Value would be called.

Comment From: a631807682

We don't know the actual type, if the GormDataType you specify is not in our enum, we can only default to a certain precision. https://github.com/go-gorm/gorm/blob/master/schema/field.go#L275 https://github.com/go-gorm/gorm/blob/master/schema/field.go#L298

I'm not sure if it's necessary to keep the clause.Assignment type, if so, it may need to be modified here. https://github.com/go-gorm/gorm/blob/master/callbacks/update.go#L274-L275

      assignValue(field, value)
      value, _ = field.ValueOf(stmt.Context, stmt.ReflectValue)
      set = append(set, clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: value})