This commit is contained in:
tangpanqing
2022-12-16 10:37:41 +08:00
parent 6379859b61
commit 65c4e72007
2 changed files with 100 additions and 32 deletions

View File

@@ -519,6 +519,25 @@ func testTransaction(db *sql.DB) {
return
}
_, errCount := aorm.Use(tx).Debug(true).Where(&Person{
Id: aorm.IntFrom(id),
}).Count("*")
if errCount != nil {
fmt.Println(errCount)
tx.Rollback()
return
}
var person Person
errPerson := aorm.Use(tx).Debug(true).Where(&Person{
Id: aorm.IntFrom(id),
}).GetOne(&person)
if errPerson != nil {
fmt.Println(errPerson)
tx.Rollback()
return
}
countUpdate, errUpdate := aorm.Use(tx).Debug(true).Where(&Person{
Id: aorm.IntFrom(id),
}).Update(&Person{