Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
tarantool_test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
test
tarantool_test
Commits
107942d6
Commit
107942d6
authored
Nov 07, 2018
by
Upliner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try2
parent
61669d74
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
main.go
main.go
+14
-8
No files found.
main.go
View file @
107942d6
...
...
@@ -62,22 +62,28 @@ func main() {
fchan
:=
make
(
chan
*
tarantool
.
Future
,
100000
)
go
func
()
{
var
row
s
[]
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment