goctl added
This commit is contained in:
24
tools/goctl/model/sql/gen/new.go
Normal file
24
tools/goctl/model/sql/gen/new.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user