diff --git a/README.md b/README.md index d758aa9..f78fd5a 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,9 @@ Configure mysql: Refer to [examples/quick_start.go](./examples/quick_start.go) -## [sub-transaction barrier](./doc/barrier-en.md) +### [sub-transaction barrier](./doc/barrier-en.md) -## [protocol](./doc/protocol-en.md) +### [protocol](./doc/protocol-en.md) ### Wechat Group @@ -98,3 +98,14 @@ If you think this project is good, or helpful to you, please give a star! ivydad eglass + +### Following is keyword for SEO + +分布式事务框架 + +事务消息 + +可靠消息 + +微服务 + diff --git a/examples/main_xa.go b/examples/main_xa.go index 9aae0ba..daa2090 100644 --- a/examples/main_xa.go +++ b/examples/main_xa.go @@ -65,7 +65,7 @@ func XaFireRequest() string { func xaTransIn(c *gin.Context) (interface{}, error) { err := XaClient.XaLocalTransaction(c, func(db *common.DB, xa *dtmcli.Xa) (rerr error) { req := reqFrom(c) - if req.TransInResult != "SUCCESS" { + if req.TransInResult == "FAILURE" { return fmt.Errorf("tranIn FAILURE") } dbr := db.Exec("update user_account set balance=balance+? where user_id=?", req.Amount, 2) @@ -81,7 +81,7 @@ func xaTransIn(c *gin.Context) (interface{}, error) { func xaTransOut(c *gin.Context) (interface{}, error) { err := XaClient.XaLocalTransaction(c, func(db *common.DB, xa *dtmcli.Xa) (rerr error) { req := reqFrom(c) - if req.TransOutResult != "SUCCESS" { + if req.TransOutResult == "FAILURE" { return fmt.Errorf("tranOut failed") } dbr := db.Exec("update user_account set balance=balance-? where user_id=?", req.Amount, 1)