feat: goctl model Add a new method hasField (#5484)

This commit is contained in:
fyyang
2026-03-22 14:26:56 +08:00
committed by GitHub
parent 004995f06a
commit 9a6447ab5c
8 changed files with 193 additions and 11 deletions

View File

@@ -360,6 +360,7 @@ func (g *defaultGenerator) genModelCustom(in parser.Table, withCache bool) (stri
t := util.With("model-custom").
Parse(text).
AddFunc("hasField", hasField(Table{Table: in})).
GoFmt(true)
output, err := t.Execute(map[string]any{
"pkg": g.pkg,
@@ -381,6 +382,7 @@ func (g *defaultGenerator) executeModel(table Table, code *code) (*bytes.Buffer,
}
t := util.With("model").
Parse(text).
AddFunc("hasField", hasField(table)).
GoFmt(true)
output, err := t.Execute(map[string]any{
"pkg": g.pkg,