forked from mirror/gorm
initialize config plugins
This commit is contained in:
parent
8f37cb0195
commit
3d3208ed60
8
gorm.go
8
gorm.go
|
@ -106,6 +106,14 @@ func Open(dialector Dialector, config *Config) (db *DB, err error) {
|
|||
|
||||
if config.Plugins == nil {
|
||||
config.Plugins = map[string]Plugin{}
|
||||
} else {
|
||||
for _, p := range config.Plugins {
|
||||
defer func(plugin Plugin) {
|
||||
if errr := plugin.Initialize(db); errr != nil {
|
||||
err = errr
|
||||
}
|
||||
}(p)
|
||||
}
|
||||
}
|
||||
|
||||
if config.cacheStore == nil {
|
||||
|
|
|
@ -8,7 +8,7 @@ require (
|
|||
github.com/lib/pq v1.6.0
|
||||
github.com/stretchr/testify v1.5.1
|
||||
gorm.io/driver/mysql v1.0.4
|
||||
gorm.io/driver/postgres v1.0.7
|
||||
gorm.io/driver/postgres v1.0.8
|
||||
gorm.io/driver/sqlite v1.1.4
|
||||
gorm.io/driver/sqlserver v1.0.6
|
||||
gorm.io/gorm v1.20.12
|
||||
|
|
Loading…
Reference in New Issue