feat : update actions gen
This commit is contained in:
1 parent
aaba20d42a
commit
fa07a57d22
14 files changed
+160
-112
No files matched your search
+34
-34
@@ -1,47 +1,47 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"go-admin/models/tools"
|
||||
"os"
|
||||
//"go-admin/models/tools"
|
||||
//"os"
|
||||
"testing"
|
||||
"text/template"
|
||||
//"text/template"
|
||||
)
|
||||
|
||||
func TestGoModelTemplate(t *testing.T) {
|
||||
t1, err := template.ParseFiles("model.go.template")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
table := tools.SysTables{}
|
||||
table.TBName = "sys_tables"
|
||||
tab, err := table.Get()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
file, err := os.Create("models/" + table.PackageName + ".go")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
_ = t1.Execute(file, tab)
|
||||
//t1, err := template.ParseFiles("model.go.template")
|
||||
//if err != nil {
|
||||
// t.Error(err)
|
||||
//}
|
||||
//table := tools.SysTables{}
|
||||
//table.TBName = "sys_tables"
|
||||
//tab, err := table.Get()
|
||||
//if err != nil {
|
||||
// t.Error(err)
|
||||
//}
|
||||
//file, err := os.Create("models/" + table.PackageName + ".go")
|
||||
//if err != nil {
|
||||
// t.Error(err)
|
||||
//}
|
||||
//defer file.Close()
|
||||
//
|
||||
//_ = t1.Execute(file, tab)
|
||||
t.Log("")
|
||||
}
|
||||
|
||||
func TestGoApiTemplate(t *testing.T) {
|
||||
t1, err := template.ParseFiles("api.go.template")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
table := tools.SysTables{}
|
||||
table.TBName = "sys_tables"
|
||||
tab, _ := table.Get()
|
||||
file, err := os.Create("apis/" + table.PackageName + ".go")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
_ = t1.Execute(file, tab)
|
||||
//t1, err := template.ParseFiles("api.go.template")
|
||||
//if err != nil {
|
||||
// t.Error(err)
|
||||
//}
|
||||
//table := tools.SysTables{}
|
||||
//table.TBName = "sys_tables"
|
||||
//tab, _ := table.Get()
|
||||
//file, err := os.Create("apis/" + table.PackageName + ".go")
|
||||
//if err != nil {
|
||||
// t.Error(err)
|
||||
//}
|
||||
//defer file.Close()
|
||||
//
|
||||
//_ = t1.Execute(file, tab)
|
||||
t.Log("")
|
||||
}
|
||||
Reference in new issue
Block a user