feat: let model customizable (#1738)

This commit is contained in:
Kevin Wan
2022-04-01 22:19:52 +08:00
committed by GitHub
parent 7e0b0ab0b1
commit 6dccfa29fd
17 changed files with 123 additions and 52 deletions

View File

@@ -25,6 +25,7 @@ const (
modelGenTemplateFile = "model-gen.tpl"
modelCustomTemplateFile = "model.tpl"
modelNewTemplateFile = "model-new.tpl"
tableNameTemplateFile = "table-name.tpl"
tagTemplateFile = "tag.tpl"
typesTemplateFile = "types.tpl"
updateTemplateFile = "update.tpl"
@@ -49,6 +50,7 @@ var templates = map[string]string{
modelGenTemplateFile: template.ModelGen,
modelCustomTemplateFile: template.ModelCustom,
modelNewTemplateFile: template.New,
tableNameTemplateFile: template.TableName,
tagTemplateFile: template.Tag,
typesTemplateFile: template.Types,
updateTemplateFile: template.Update,
@@ -72,7 +74,7 @@ func GenTemplates(_ *cli.Context) error {
return pathx.InitTemplates(category, templates)
}
// RevertTemplate recovers the delete template files
// RevertTemplate reverts the deleted template files
func RevertTemplate(name string) error {
content, ok := templates[name]
if !ok {