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()) + } + + } + +} + +