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/new.go

25 lines
506 B
Go

4 years ago
package gen
import (
"bytes"
"text/template"
sqltemplate "github.com/tal-tech/go-zero/tools/goctl/model/sql/template"
4 years ago
)
func genNew(table *InnerTable) (string, error) {
t, err := template.New("new").Parse(sqltemplate.New)
if err != nil {
return "", err
}
newBuffer := new(bytes.Buffer)
err = t.Execute(newBuffer, map[string]interface{}{
"containsCache": table.ContainsCache,
"upperObject": table.UpperCamelCase,
})
if err != nil {
return "", err
}
return newBuffer.String(), nil
}