文档结构改成树型结构表

master
zcy 2022-04-12 01:40:39 +08:00
parent 3f3df0d034
commit 1c687bbc21
1 changed files with 35 additions and 0 deletions

View File

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