support api templates

This commit is contained in:
kevin
2020-10-15 16:36:49 +08:00
parent 8291eabc2c
commit f904710811
32 changed files with 274 additions and 155 deletions

View File

@@ -2,12 +2,12 @@ package gen
import (
"github.com/tal-tech/go-zero/tools/goctl/model/sql/template"
"github.com/tal-tech/go-zero/tools/goctl/util"
"github.com/tal-tech/go-zero/tools/goctl/templatex"
)
func genImports(withCache, timeImport bool) (string, error) {
if withCache {
buffer, err := util.With("import").Parse(template.Imports).Execute(map[string]interface{}{
buffer, err := templatex.With("import").Parse(template.Imports).Execute(map[string]interface{}{
"time": timeImport,
})
if err != nil {
@@ -15,7 +15,7 @@ func genImports(withCache, timeImport bool) (string, error) {
}
return buffer.String(), nil
} else {
buffer, err := util.With("import").Parse(template.ImportsNoCache).Execute(map[string]interface{}{
buffer, err := templatex.With("import").Parse(template.ImportsNoCache).Execute(map[string]interface{}{
"time": timeImport,
})
if err != nil {