Skip to content

Commit

Permalink
enhance: add ORM tag to the entity result of command gen dao to mak…
Browse files Browse the repository at this point in the history
…e entity assignment more faster (#3454)
  • Loading branch information
wln32 committed Apr 7, 2024
1 parent 505fc25 commit b040654
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
11 changes: 8 additions & 3 deletions cmd/gf/internal/cmd/gendao/gendao_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,14 @@ func generateStructFieldDefinition(
" #" + gstr.CaseCamel(newFiledName),
" #" + localTypeNameStr,
}
attrLines = append(attrLines, " #"+fmt.Sprintf(tagKey+`json:"%s"`, jsonTag))
attrLines = append(attrLines, " #"+fmt.Sprintf(`description:"%s"`+tagKey, descriptionTag))
attrLines = append(attrLines, " #"+fmt.Sprintf(`// %s`, formatComment(field.Comment)))
attrLines = append(attrLines, fmt.Sprintf(` #%sjson:"%s"`, tagKey, jsonTag))
// orm tag
if !in.IsDo {
// entity
attrLines = append(attrLines, fmt.Sprintf(` #orm:"%s"`, field.Name))
}
attrLines = append(attrLines, fmt.Sprintf(` #description:"%s"%s`, descriptionTag, tagKey))
attrLines = append(attrLines, fmt.Sprintf(` #// %s`, formatComment(field.Comment)))

for k, v := range attrLines {
if in.NoJsonTag {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/testdata/issue/2746/issue_2746.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b040654

Please sign in to comment.