Browse Source

fix: at sample (#374)

fix at rolback sample
tags/1.0.2-RC1^0
Yuecai Liu GitHub 2 years ago
parent
commit
b1f47f0fc5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 11 deletions
  1. +1
    -11
      sample/at/basic/main.go

+ 1
- 11
sample/at/basic/main.go View File

@@ -45,16 +45,6 @@ func main() {
<-make(chan struct{})
}

func selectData() {
var orderTbl OrderTbl
row := db.QueryRow("select id,user_id,commodity_code,count,money,descs from order_tbl where id = ? ", 1)
err := row.Scan(&orderTbl.id, &orderTbl.userID, &orderTbl.commodityCode, &orderTbl.count, &orderTbl.money, &orderTbl.descs)
if err != nil {
panic(err)
}
fmt.Println(orderTbl)
}

func updateData(ctx context.Context) error {
sql := "update order_tbl set descs=? where id=?"
ret, err := db.ExecContext(ctx, sql, fmt.Sprintf("NewDescs-%d", time.Now().UnixMilli()), 1)
@@ -68,5 +58,5 @@ func updateData(ctx context.Context) error {
return err
}
fmt.Printf("update success: %d.\n", rows)
return fmt.Errorf("test error")
return nil
}

Loading…
Cancel
Save