Skip to content

Commit

Permalink
fix: at sample (#374)
Browse files Browse the repository at this point in the history
fix at rolback sample
  • Loading branch information
luky116 authored Nov 26, 2022
1 parent ee912f4 commit b1f47f0
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions sample/at/basic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

0 comments on commit b1f47f0

Please sign in to comment.