make it optional by giving it a workaround field
This commit is contained in:
parent
13cd287a6f
commit
3be836c724
4
gorm.go
4
gorm.go
@ -32,6 +32,10 @@ type Config struct {
|
||||
DisableAutomaticPing bool
|
||||
// DisableForeignKeyConstraintWhenMigrating
|
||||
DisableForeignKeyConstraintWhenMigrating bool
|
||||
// Workarounds this is for some exotic databases that requires internal changes rather than avoiding the problem by extending the dialects
|
||||
Workarounds struct {
|
||||
DoColumnLowerCasing bool
|
||||
}
|
||||
|
||||
// ClauseBuilders clause builder
|
||||
ClauseBuilders map[string]clause.ClauseBuilder
|
||||
|
2
scan.go
2
scan.go
@ -14,9 +14,11 @@ func Scan(rows *sql.Rows, db *DB, initialized bool) {
|
||||
columns, _ := rows.Columns()
|
||||
values := make([]interface{}, len(columns))
|
||||
|
||||
if db.Workarounds.DoColumnLowerCasing {
|
||||
columns = funk.Map(columns, func(s string) string {
|
||||
return strings.ToLower(s)
|
||||
}).([]string)
|
||||
}
|
||||
|
||||
switch dest := db.Statement.Dest.(type) {
|
||||
case map[string]interface{}, *map[string]interface{}:
|
||||
|
Loading…
x
Reference in New Issue
Block a user