File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ type Config struct {
31
31
PreferSimpleProtocol bool
32
32
WithoutReturning bool
33
33
Conn gorm.ConnPool
34
+ OptionOpenDB []stdlib.OptionOpenDB
34
35
}
35
36
36
37
var (
@@ -102,10 +103,9 @@ func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
102
103
config .DefaultQueryExecMode = pgx .QueryExecModeSimpleProtocol
103
104
}
104
105
result := timeZoneMatcher .FindStringSubmatch (dialector .Config .DSN )
105
- var options []stdlib.OptionOpenDB
106
106
if len (result ) > 2 {
107
107
config .RuntimeParams ["timezone" ] = result [2 ]
108
- options = append (options , stdlib .OptionAfterConnect (func (ctx context.Context , conn * pgx.Conn ) error {
108
+ dialector . OptionOpenDB = append (dialector . OptionOpenDB , stdlib .OptionAfterConnect (func (ctx context.Context , conn * pgx.Conn ) error {
109
109
loc , tzErr := time .LoadLocation (result [2 ])
110
110
if tzErr != nil {
111
111
return tzErr
@@ -118,7 +118,7 @@ func (dialector Dialector) Initialize(db *gorm.DB) (err error) {
118
118
return nil
119
119
}))
120
120
}
121
- db .ConnPool = stdlib .OpenDB (* config , options ... )
121
+ db .ConnPool = stdlib .OpenDB (* config , dialector . OptionOpenDB ... )
122
122
}
123
123
return
124
124
}
You can’t perform that action at this time.
0 commit comments