From 1f42653b4c25ccaeb8f526414c85cf696cf9098d Mon Sep 17 00:00:00 2001 From: huangsimin Date: Mon, 10 Dec 2018 17:13:22 +0800 Subject: [PATCH] 123 --- logdb_test.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/logdb_test.go b/logdb_test.go index 1e1aa37..cd26119 100644 --- a/logdb_test.go +++ b/logdb_test.go @@ -3,6 +3,7 @@ package logdb import ( "log" "testing" + "time" _ "github.com/go-sql-driver/mysql" ) @@ -14,11 +15,38 @@ import ( // port: 4000 // 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.Connect() t.Error(logdb) rows := logdb.Select("select * from log_spider limit 10;") log.Println(rows) + + var l []ADStore + for rows.Next() { + ad := ADStore{} + rows.Scan(&ad) + l = append(l, ad) + } + log.Println(len(l)) }