Commit 107942d6 authored by Upliner's avatar Upliner

Try2

parent 61669d74
......@@ -62,22 +62,28 @@ func main() {
fchan := make(chan *tarantool.Future, 100000)
go func() {
var rows []struct {
var row struct {
ID uint32 `db:"id" json:"-"`
CatID uint32 `json:"-"`
URL string `json:"url"`
Title string `json:"name"`
Price float64 `json:"price"`
Price json.Number `json:"price"`
Brand string `json:"vendor"`
ImageURL float64 `json:"picture"`
OldPrice float64 `json:"oldprice"`
ImageURL string `json:"picture"`
OldPrice json.Number `json:"oldprice"`
CurrencyID string `json:"currencyId"`
Description string `json:"description"`
}
ms.Select(&rows,"SELECT ID,CatID,URL,Title,Price,Brand,ImageURL,OldPrice,CurrencyID,Description from goods")
fmt.Println("Got",len(rows), "rows")
for _, row := range rows{
bs, _ := json.Marshal(row)
rows, err := ms.Query("SELECT id,CatID,URL,Title,Price,Brand,ImageURL,OldPrice,CurrencyID,Description from goods")
if err != nil{
log.Fatal(err)
}
for rows.Next(){
err := rows.Scan(&row.ID,&row.CatID,&row.URL,&row.Title,&row.Price,&row.Brand,&row.ImageURL,&row.OldPrice,&row.CurrencyID,&row.Description)
if err != nil {
log.Fatal(err)
}
bs, _ := json.Marshal(&row)
fchan <- conn.InsertAsync("retarg_goods", []interface{}{row.ID, row.CatID,string(bs)})
}
close(fchan)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment