123
This commit is contained in:
parent
8516f77157
commit
1f42653b4c
|
@ -3,6 +3,7 @@ package logdb
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
)
|
)
|
||||||
|
@ -14,11 +15,38 @@ import (
|
||||||
// port: 4000
|
// port: 4000
|
||||||
// user: spider
|
// user: spider
|
||||||
|
|
||||||
func TestSelect(t *testing.T) {
|
type ADStore struct {
|
||||||
|
uid string
|
||||||
|
spider_id int
|
||||||
|
device string
|
||||||
|
platform string
|
||||||
|
channel int
|
||||||
|
media int
|
||||||
|
area_cc string
|
||||||
|
catch_account_id int
|
||||||
|
section_id string
|
||||||
|
response string
|
||||||
|
status int
|
||||||
|
error_msg string
|
||||||
|
ext string
|
||||||
|
priority int
|
||||||
|
ts_crawl time.Time
|
||||||
|
ts_update time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSelect(t *testing.T) {
|
||||||
|
log.SetFlags(log.Llongfile)
|
||||||
logdb := NewLogDB("logdb.yaml")
|
logdb := NewLogDB("logdb.yaml")
|
||||||
logdb.Connect()
|
logdb.Connect()
|
||||||
t.Error(logdb)
|
t.Error(logdb)
|
||||||
rows := logdb.Select("select * from log_spider limit 10;")
|
rows := logdb.Select("select * from log_spider limit 10;")
|
||||||
log.Println(rows)
|
log.Println(rows)
|
||||||
|
|
||||||
|
var l []ADStore
|
||||||
|
for rows.Next() {
|
||||||
|
ad := ADStore{}
|
||||||
|
rows.Scan(&ad)
|
||||||
|
l = append(l, ad)
|
||||||
|
}
|
||||||
|
log.Println(len(l))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user