query dialect ignore case sensitive
This commit is contained in:
parent
60b1704516
commit
2fbe2c76c6
|
@ -287,7 +287,7 @@ func (b *Base) LogSQL(sql string, args []interface{}) {
|
|||
}
|
||||
|
||||
var (
|
||||
dialects = map[DbType]func() Dialect{}
|
||||
dialects = map[string]func() Dialect{}
|
||||
)
|
||||
|
||||
// RegisterDialect register database dialect
|
||||
|
@ -295,12 +295,12 @@ func RegisterDialect(dbName DbType, dialectFunc func() Dialect) {
|
|||
if dialectFunc == nil {
|
||||
panic("core: Register dialect is nil")
|
||||
}
|
||||
dialects[dbName] = dialectFunc // !nashtsai! allow override dialect
|
||||
dialects[strings.ToLower(string(dbName))] = dialectFunc // !nashtsai! allow override dialect
|
||||
}
|
||||
|
||||
// QueryDialect query if registed database dialect
|
||||
func QueryDialect(dbName DbType) Dialect {
|
||||
if d, ok := dialects[dbName]; ok {
|
||||
if d, ok := dialects[strings.ToLower(string(dbName))]; ok {
|
||||
return d()
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue