Skip to content

Commit 720a88e

Browse files
committed
...
1 parent 399c828 commit 720a88e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal/codegen/golang/result.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,17 @@ func newGoEmbed(req *plugin.CodeGenRequest, tableName string, embed *plugin.Iden
138138
continue
139139
}
140140

141-
structName := tableName
142-
if !req.Settings.Go.EmitExactTableNames {
141+
structName := s.Name
142+
143+
if tableName != s.Table.Name && !req.Settings.Go.EmitExactTableNames {
143144
structName = inflection.Singular(inflection.SingularParams{
144-
Name: structName,
145+
Name: tableName,
145146
Exclusions: req.Settings.Go.InflectionExcludeTableNames,
146147
})
147148
}
148149

149150
fields := make([]Field, len(s.Fields))
150-
for i, f := range s.Fields {
151-
fields[i] = f
152-
}
151+
copy(fields, s.Fields)
153152

154153
return &goEmbed{
155154
modelType: s.Name,

0 commit comments

Comments
 (0)