Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wubin48435 committed Jun 11, 2024
1 parent 06736dc commit 807dfd7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions toolkit/caches/caches.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ func (c *Caches) Query(callback func(*gorm.DB)) func(*gorm.DB) {
return
}

if _, ok := db.Statement.ConnPool.(gorm.TxCommitter); ok {
// query from database directly when in transaction
identifier := buildIdentifier(db)
if stringutils.ContainsI(identifier, "INSERT INTO") {
callback(db)
c.AfterWrite(db)
return
}

identifier := buildIdentifier(db)
if stringutils.ContainsI(identifier, "INSERT INTO") {
if _, ok := db.Statement.ConnPool.(gorm.TxCommitter); ok {
// query from database directly when in transaction
callback(db)
c.AfterWrite(db)
return
}

Expand Down

0 comments on commit 807dfd7

Please sign in to comment.