forked from mirror/gorm
380cc64ff5
* fix type alias AutoMigrate bug. eg ```go package main type IDer interface{ GetID() int64 } // ID will add some method to implement some interface eg: GetID type ID int64 func (z ID) GetID() int64 { return int64(z) } type Test struct { ID Code string `gorm:"size:50"` Name string `gorm:"size:50"` } func main() { db, err := gorm.Open(postgres.New(postgres.Config{ DSN: `dsn`, PreferSimpleProtocol: false, }), &gorm.Config{ Logger: logger.Default.LogMode(logger.Info), SkipDefaultTransaction: true, }) if err != nil { log.Fatal(err) } if err = db.AutoMigrate(&Test{}); err != nil { // invalid embedded struct for Test's field ID, should be struct, but got main.ID log.Fatal(err) } } ``` * fix type alias AutoMigrate bug. eg ```go package main type IDer interface{ GetID() int64 } // ID will add some method to implement some interface eg: GetID type ID int64 func (z ID) GetID() int64 { return int64(z) } type Test struct { ID Code string `gorm:"size:50"` Name string `gorm:"size:50"` } func main() { db, err := gorm.Open(postgres.New(postgres.Config{ DSN: `dsn`, PreferSimpleProtocol: false, }), &gorm.Config{ Logger: logger.Default.LogMode(logger.Info), SkipDefaultTransaction: true, }) if err != nil { log.Fatal(err) } if err = db.AutoMigrate(&Test{}); err != nil { // invalid embedded struct for Test's field ID, should be struct, but got main.ID log.Fatal(err) } } ``` * Add typealis test. * try to fix golangci-lint |
||
---|---|---|
.. | ||
callbacks_test.go | ||
check.go | ||
check_test.go | ||
field.go | ||
field_test.go | ||
index.go | ||
index_test.go | ||
interfaces.go | ||
model_test.go | ||
naming.go | ||
naming_test.go | ||
relationship.go | ||
relationship_test.go | ||
schema.go | ||
schema_helper_test.go | ||
schema_test.go | ||
utils.go | ||
utils_test.go |