Skip to content

Commit

Permalink
测试文件更新
Browse files Browse the repository at this point in the history
  • Loading branch information
beiming-org committed Jan 10, 2020
1 parent 86576be commit 3c9dc6b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions test/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,14 @@ func TestConnMysql(t *testing.T) {
fmt.Println("====================transaction========================")
tx, err := db.Begin()
row, err := tx.GetRow("txGetInfo", 1)
t.Log(row)
if err != nil {
fmt.Println("错误1:", err)
}
if len(row) == 0 {
tx.Commit()
return
}
_, err = tx.Update("update goods set stock = ? where id = ?", row["stock"].(int64)-1, row["id"])
if err != nil {
fmt.Println(err)
tx.Rollback()
return
} else {
_, err = tx.Update("update goods set stock = ? where id = ?", row["stock"].(int64)-1, row["id"])
if err != nil {
fmt.Println(err)
tx.Rollback()
}
tx.Commit()
}
tx.Commit()
}

0 comments on commit 3c9dc6b

Please sign in to comment.