|
@@ -45,16 +45,6 @@ func main() { |
|
|
<-make(chan struct{}) |
|
|
<-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 { |
|
|
func updateData(ctx context.Context) error { |
|
|
sql := "update order_tbl set descs=? where id=?" |
|
|
sql := "update order_tbl set descs=? where id=?" |
|
|
ret, err := db.ExecContext(ctx, sql, fmt.Sprintf("NewDescs-%d", time.Now().UnixMilli()), 1) |
|
|
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 |
|
|
return err |
|
|
} |
|
|
} |
|
|
fmt.Printf("update success: %d.\n", rows) |
|
|
fmt.Printf("update success: %d.\n", rows) |
|
|
return fmt.Errorf("test error") |
|
|
|
|
|
|
|
|
return nil |
|
|
} |
|
|
} |