go-zero/tools/goctl/model/sql/gen/imports.go

24 lines
486 B
Go
Raw Normal View History

2020-07-29 17:11:41 +08:00
package gen
import (
"bytes"
"text/template"
2020-08-08 16:40:10 +08:00
sqltemplate "github.com/tal-tech/go-zero/tools/goctl/model/sql/template"
2020-07-29 17:11:41 +08:00
)
func genImports(table *InnerTable) (string, error) {
t, err := template.New("imports").Parse(sqltemplate.Imports)
if err != nil {
return "", err
}
importBuffer := new(bytes.Buffer)
err = t.Execute(importBuffer, map[string]interface{}{
"containsCache": table.ContainsCache,
})
if err != nil {
return "", err
}
return importBuffer.String(), nil
}