You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/tools/goctl/model/sql/gen/imports.go

27 lines
632 B
Go

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