Skip to content

Commit 751a6dd

Browse files
authored
Call after initialize for gorm.Config (#7518)
1 parent 2f4925e commit 751a6dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gorm.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ func Open(dialector Dialector, opts ...Option) (db *DB, err error) {
137137
return isConfig && !isConfig2
138138
})
139139

140+
if len(opts) > 0 {
141+
if c, ok := opts[0].(*Config); ok {
142+
config = c
143+
} else {
144+
opts = append([]Option{config}, opts...)
145+
}
146+
}
147+
140148
var skipAfterInitialize bool
141149
for _, opt := range opts {
142150
if opt != nil {

0 commit comments

Comments
 (0)