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

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


The following commit(s) were added to refs/heads/main by this push:
     new ea9327f  fix: insert_on_update (#86)
ea9327f is described below

commit ea9327fb207368f127cf85e432ae4aae01e384bf
Author: TewGuo <[email protected]>
AuthorDate: Sun Dec 21 23:08:27 2025 +0800

    fix: insert_on_update (#86)
    
    Co-authored-by: guotun <[email protected]>
---
 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