代码生成器实现

This commit is contained in:
pixel
2020-03-30 14:21:51 +08:00
parent 5d89b8728b
commit 87c5e691f6
3 changed files with 10 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ import (
"os"
)
//开发中功能,若您发现这块代码可以研究,可以无视
// 初始版本自动化代码工具
type AutoCodeStruct struct {
StructName string `json:"structName"`
PackageName string `json:"packageName"`
@@ -21,11 +21,6 @@ type Field struct {
ColumnName string `json:"columnName"`
}
type Dictionary struct {
Label string `json:"label"`
Value string `json:"value"`
}
func (a *AutoCodeStruct) CreateTemp() (err error) {
basePath := "./tpl"
modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl")
@@ -107,11 +102,11 @@ func (a *AutoCodeStruct) CreateTemp() (err error) {
return err
}
}
model.Close()
api.Close()
router.Close()
feapi.Close()
readme.Close()
_ = model.Close()
_ = api.Close()
_ = router.Close()
_ = feapi.Close()
_ = readme.Close()
fileList := []string{
_te + a.PackageName + "/model/model.go",
_te + a.PackageName + "/api/api.go",