This is an automated email from the ASF dual-hosted git repository.

tew pushed a commit to branch fix/insert_on_update
in repository https://gitbox.apache.org/repos/asf/incubator-seata-go-samples.git

commit 8cb8e06d22a576cf1e6bd90c0a19ab743a6b8017
Author: guotun <[email protected]>
AuthorDate: Sun Dec 21 22:56:52 2025 +0800

    fix: insert_on_update
---
 integrate_test/at/insert_on_update/main.go | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/integrate_test/at/insert_on_update/main.go 
b/integrate_test/at/insert_on_update/main.go
index ef442ee..2a326c8 100644
--- a/integrate_test/at/insert_on_update/main.go
+++ b/integrate_test/at/insert_on_update/main.go
@@ -58,7 +58,8 @@ func main() {
        ctx := context.Background()
 
        // check
-       if checkData(ctx) != nil {
+       if err := checkData(ctx); err != nil {
+               fmt.Println(err)
                panic("failed")
        }
 
@@ -93,10 +94,10 @@ func initDB() {
 func getData() OrderTblModel {
        return OrderTblModel{
                Id:            1,
-               UserId:        "NO-100003",
-               CommodityCode: "C100001",
+               UserId:        "NO-100001",
+               CommodityCode: "C100000",
                Count:         101,
-               Money:         11,
+               Money:         10,
                Descs:         "insert desc",
        }
 }
@@ -108,7 +109,7 @@ func insertOnUpdateData(ctx context.Context) error {
        return 
gormDB.WithContext(ctx).Table("order_tbl").Clauses(clause.OnConflict{
                Columns: []clause.Column{{Name: "id"}},
                DoUpdates: clause.Assignments(map[string]interface{}{
-                       "descs": data.Descs,
+                       "count": data.Count,
                }),
        }).Create(&data).Error
 }
@@ -120,6 +121,7 @@ func checkData(ctx context.Context) error {
        if err != nil {
                return err
        }
+       fmt.Println("count:", count)
        if count != 1 {
                return fmt.Errorf("check data failed")
        }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to