Skip to content

Commit

Permalink
Merge pull request #736 from go-gorm/fix_rep_db
Browse files Browse the repository at this point in the history
fix: replace db
  • Loading branch information
qqxhb authored Jan 4, 2023
2 parents 8b6f628 + 9cf24c3 commit adde295
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion do.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func (d *DO) UseDB(db *gorm.DB, opts ...DOOption) {
}

// ReplaceDB replace db connection
func (d *DO) ReplaceDB(db *gorm.DB) { d.db = db }
func (d *DO) ReplaceDB(db *gorm.DB) {
d.db = db.Session(&gorm.Session{})
}

// ReplaceConnPool replace db connection pool
func (d *DO) ReplaceConnPool(pool gorm.ConnPool) {
Expand Down

0 comments on commit adde295

Please sign in to comment.