新增系统设置接口

This commit is contained in:
wxb committed 2020-08-07 10:22:52 +08:00
commit 389d2970c0
150 files changed
+21555

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
package test
import (
"go-admin/models/tools"
"os"
"testing"
"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)
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)
t.Log("")
}