makes DialectsMap public for easier registration of dialects using existing values refs #1572
This commit is contained in:
parent
c3bb6aaa82
commit
b907a3d902
@ -48,10 +48,10 @@ type Dialect interface {
|
|||||||
CurrentDatabase() string
|
CurrentDatabase() string
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialectsMap = map[string]Dialect{}
|
var DialectsMap = map[string]Dialect{}
|
||||||
|
|
||||||
func newDialect(name string, db SQLCommon) Dialect {
|
func newDialect(name string, db SQLCommon) Dialect {
|
||||||
if value, ok := dialectsMap[name]; ok {
|
if value, ok := DialectsMap[name]; ok {
|
||||||
dialect := reflect.New(reflect.TypeOf(value).Elem()).Interface().(Dialect)
|
dialect := reflect.New(reflect.TypeOf(value).Elem()).Interface().(Dialect)
|
||||||
dialect.SetDB(db)
|
dialect.SetDB(db)
|
||||||
return dialect
|
return dialect
|
||||||
@ -65,7 +65,7 @@ func newDialect(name string, db SQLCommon) Dialect {
|
|||||||
|
|
||||||
// RegisterDialect register new dialect
|
// RegisterDialect register new dialect
|
||||||
func RegisterDialect(name string, dialect Dialect) {
|
func RegisterDialect(name string, dialect Dialect) {
|
||||||
dialectsMap[name] = dialect
|
DialectsMap[name] = dialect
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseFieldStructForDialect get field's sql data type
|
// ParseFieldStructForDialect get field's sql data type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user