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
483 B
Go

4 years ago
package gen
import (
"bytes"
"text/template"
sqltemplate "zero/tools/goctl/model/sql/template"
)
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
}