Generator clean up refactoring.

This commit is contained in:
zer0sub 2019-05-24 13:13:13 +02:00
parent 7de8c1c45e
commit b3a52ceb31
16 changed files with 372 additions and 476 deletions

View file

@ -8,6 +8,7 @@ import (
"path/filepath"
"strings"
"text/template"
"time"
)
func saveGoFile(dirPath, fileName string, text []byte) error {
@ -49,10 +50,13 @@ func ensureDirPath(dirPath string) error {
func generateTemplate(templateText string, templateData interface{}) ([]byte, error) {
t, err := template.New("SqlBuilderTableTemplate").Funcs(template.FuncMap{
t, err := template.New("sqlBuilderTableTemplate").Funcs(template.FuncMap{
"camelize": func(txt string) string {
return snaker.SnakeToCamel(strings.Replace(txt, "-", "_", -1))
},
"now": func() string {
return time.Now().Format(time.RFC850)
},
}).Parse(templateText)
if err != nil {