MCPcopy
hub / github.com/go-gorm/gorm / CommitOrRollbackTransaction

Function CommitOrRollbackTransaction

callbacks/transaction.go:20–32  ·  view source on GitHub ↗
(db *gorm.DB)

Source from the content-addressed store, hash-verified

18}
19
20func CommitOrRollbackTransaction(db *gorm.DB) {
21 if !db.Config.SkipDefaultTransaction {
22 if _, ok := db.InstanceGet("gorm:started_transaction"); ok {
23 if db.Error != nil {
24 db.Rollback()
25 } else {
26 db.Commit()
27 }
28
29 db.Statement.ConnPool = db.ConnPool
30 }
31 }
32}

Callers

nothing calls this directly

Calls 3

InstanceGetMethod · 0.80
RollbackMethod · 0.65
CommitMethod · 0.65

Tested by

no test coverage detected