fix bug on new engine (#679)

This commit is contained in:
Lunny Xiao 2017-08-07 11:33:52 +08:00 committed by GitHub
parent 0fdfa8d8de
commit f43b29056d
1 changed files with 4 additions and 1 deletions

View File

@ -50,10 +50,13 @@ func close(engine *Engine) {
engine.Close()
}
func init() {
regDrvsNDialects()
}
// NewEngine new a db manager according to the parameter. Currently support four
// drivers
func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
regDrvsNDialects()
driver := core.QueryDriver(driverName)
if driver == nil {
return nil, fmt.Errorf("Unsupported driver name: %v", driverName)