* 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
* Refactor ParseWithSchemaTable method and improve test.
* Fix schema.ParseWithSchemaTable method for only use schemaTable in migrator and improve test.
* Rename `schemaTable` to `specialTableName` for clearly argument.
* fixed belongs_to & has_one reversed if field same
* hasmany same foreign key bug fixed and test added
* belongsToSameForeignKey fixed and reverted old fix
* optimize gormSourceDir replace
* fmt.Errorf adjust and Optimize for-break
* strings trim
* feat: avoid using the same name field and if..else optimization adjustment
* optimization callbacks/create.go Create func if...else logic
* fix: callbacks/create.go Create func
* fix FileWithLineNum func and add gormSourceDir unit test
* remove debug print and utils_filenum_test.go
* Respect ignore migration when add column (#4276)
continue https://github.com/go-gorm/gorm/pull/4028
* feat: Optimal value type acquisition for v (#4278)
* feat: optimize relect value length and value
* feat: optimize ConvertSliceOfMapToValuesForCreate method
Co-authored-by: yrong1997 <yrong1997@gmail.com>
* for Config.cacheStore store PreparedStmtDB key
* invalid db error and value and invalid value length error (#4151)
* support named params in Select API (#4142)
* adds support for named arguments in select
* changes clause identifies and adds test
* optimize match english letters and midline
Co-authored-by: Ratan Phayade <ratanphayade@users.noreply.github.com>
* change the method of initializing slice and fixed the length to be specified as 0
* keep the association.go code in the var group
* keep the association.go code in the var group
* change to initializing in var group
* Change NameReplacer to an interface, allowing custom Replacers.
* Add NoLowerCase option to skip the snake_casing of names.
* Move sync.Map from global variable into member of NamingStrategy.
This maintains backward compatibility by making the smap optional - the
NamingStrategy still works if it is nil. gorm.Open activates it by
calling Init() if the given Namer is a schema.NamingStrategy.
Also, this changes the key stored in the smap to be the original name,
instead of the replaced name.
* Refactor NamingStrategy tests to add more assertions about how and when Replacers get called.
* Remove the name cache from NamingStrategy.