goctl added
This commit is contained in:
23
tools/goctl/model/sql/gen/imports.go
Normal file
23
tools/goctl/model/sql/gen/imports.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package gen
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"text/template"
|
||||
|
||||
sqltemplate "zero/tools/goctl/model/sql/template"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user