From 1c687bbc216ba2d66501fffe8548e57f861a46b9 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Tue, 12 Apr 2022 01:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E7=BB=93=E6=9E=84=E6=94=B9?= =?UTF-8?q?=E6=88=90=E6=A0=91=E5=9E=8B=E7=BB=93=E6=9E=84=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/portData_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/portData_test.go b/test/portData_test.go index 999c609..66fdffe 100644 --- a/test/portData_test.go +++ b/test/portData_test.go @@ -10,6 +10,7 @@ import ( "log" "reflect" "testing" + "time" "github.com/olivere/elastic" ) @@ -128,3 +129,37 @@ func TestChangeStructFieldThroughStruct(t *testing.T) { fmt.Println(cap(e0)) fmt.Println(cap(arr1)) } + + +func TestPortDocVersion(t *testing.T) { + InitConfig() + InitLogs() + InitRedisConfig() + InitMysql() + + doc_groups := []model.DocGroup{} + e := db.GetMysqlClient().Query2("select * from doc_group",&doc_groups) + + if nil != e{ + log.Print(e.Error()) + } + for k,v := range doc_groups{ + log.Print(k,v) + e := db.GetMysqlClient().Query2("select * from doc_group",&doc_groups) + if(nil != e){ + log.Print(e.Error()) + + } + str := fmt.Sprintf("insert into doc_copy1 (title,type,content,author,create_time,version,is_public, deleted,origin_url,es_id,father,level) values ('%s',0,'','admin','%s', 1,1,0,'','',0,0)", + v.Name,time.Now().Format("2006-01-02 15:04:05")) + log.Print(str) + _,e = db.GetMysqlClient().Query(str) + if nil != e{ + log.Print(e.Error()) + } + + } + +} + +