Skip to content

Commit 2206ec5

Browse files
committed
DefaultFactory不再默认内置支持mysql。
1 parent fef899b commit 2206ec5

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

faccreator.go

-12
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,6 @@ func CreateFactory(opts ...FacOpt) (factory.Factory, error) {
3131
}
3232
}
3333

34-
//For compatibility with older versions
35-
if f.DataSource == nil {
36-
f.DataSource = &datasource.MysqlDataSource{
37-
Host: f.Host,
38-
Port: f.Port,
39-
DBName: f.DBName,
40-
Username: f.Username,
41-
Password: f.Password,
42-
Charset: f.Charset,
43-
}
44-
}
45-
4634
err := f.Open(f.DataSource)
4735
if err != nil {
4836
return nil, err

factory/default_factory.go

+5-13
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,6 @@ import (
2121
)
2222

2323
type DefaultFactory struct {
24-
// Deprecated: Use gobatis.NewFactory instead.
25-
Host string
26-
// Deprecated: Use gobatis.NewFactory instead.
27-
Port int
28-
// Deprecated: Use gobatis.NewFactory instead.
29-
DBName string
30-
// Deprecated: Use gobatis.NewFactory instead.
31-
Username string
32-
// Deprecated: Use gobatis.NewFactory instead.
33-
Password string
34-
// Deprecated: Use gobatis.NewFactory instead.
35-
Charset string
36-
3724
MaxConn int
3825
MaxIdleConn int
3926
ConnMaxLifetime time.Duration
@@ -103,3 +90,8 @@ func (f *DefaultFactory) WithLock(lockFunc func(fac *DefaultFactory)) {
10390
lockFunc(f)
10491
f.mutex.Unlock()
10592
}
93+
94+
// Deprecated: Use Open instead
95+
func (f *DefaultFactory) InitDB() error {
96+
return f.Open(f.DataSource)
97+
}

0 commit comments

Comments
 (0)