mirror of https://github.com/go-gorm/gorm.git
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:
|
case reflect.Struct:
|
||||||
if field.IsScanner() {
|
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() {
|
} else if !field.IsTime() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue