mirror of https://github.com/go-gorm/gorm.git
Fix pointers for AutoMigrate
This commit is contained in:
parent
b33f30714b
commit
9757958106
6
field.go
6
field.go
|
@ -34,7 +34,11 @@ func (field *Field) IsScanner() bool {
|
|||
}
|
||||
|
||||
func (field *Field) IsTime() bool {
|
||||
_, isTime := field.Field.Interface().(time.Time)
|
||||
reflectValue := field.Field
|
||||
if reflectValue.Kind() == reflect.Ptr {
|
||||
reflectValue = reflect.New(reflectValue.Type().Elem()).Elem()
|
||||
}
|
||||
_, isTime := reflectValue.Interface().(time.Time)
|
||||
return isTime
|
||||
}
|
||||
|
||||
|
|
|
@ -393,6 +393,9 @@ func (scope *Scope) sqlTagForField(field *Field) (typ string) {
|
|||
|
||||
value := field.Field.Interface()
|
||||
reflectValue := field.Field
|
||||
if reflectValue.Kind() == reflect.Ptr {
|
||||
reflectValue = reflect.New(reflectValue.Type().Elem()).Elem()
|
||||
}
|
||||
|
||||
switch reflectValue.Kind() {
|
||||
case reflect.Slice:
|
||||
|
|
Loading…
Reference in New Issue