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.
25 lines
483 B
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
|
||
|
}
|