make it optional by giving it a workaround field

This commit is contained in:
Steve Fan 2020-07-20 21:26:30 +08:00
parent 13cd287a6f
commit 3be836c724
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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{}: