forked from mirror/gorm
Fix AutoMigrate with nested Scanner
This commit is contained in:
parent
90106d82c5
commit
8308491d9a
|
@ -339,7 +339,14 @@ func (scope *Scope) sqlTagForField(field *Field) (typ string) {
|
|||
}
|
||||
case reflect.Struct:
|
||||
if field.IsScanner() {
|
||||
reflectValue = reflectValue.Field(0)
|
||||
var getScannerValue func(reflect.Value)
|
||||
getScannerValue = func(value reflect.Value) {
|
||||
reflectValue = value
|
||||
if _, isScanner := reflect.New(reflectValue.Type()).Interface().(sql.Scanner); isScanner {
|
||||
getScannerValue(reflectValue.Field(0))
|
||||
}
|
||||
}
|
||||
getScannerValue(reflectValue.Field(0))
|
||||
} else if !field.IsTime() {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue