@@ -79,13 +79,13 @@ func (r *Result) Structs(settings config.CombinedSettings) []dinosql.GoStruct {
7979 var structs []dinosql.GoStruct
8080 for tableName , cols := range r .Schema .tables {
8181 s := dinosql.GoStruct {
82- Name : inflection .Singular (dinosql .StructName (tableName , settings )),
82+ Name : inflection .Singular (dinosql .GetStructName (tableName , settings )),
8383 Table : core.FQN {tableName , "" , "" }, // TODO: Complete hack. Only need for equality check to see if struct can be reused between queries
8484 }
8585
8686 for _ , col := range cols {
8787 s .Fields = append (s .Fields , dinosql.GoField {
88- Name : dinosql .StructName (col .Name .String (), settings ),
88+ Name : dinosql .GetColumnName (col .Name .String (), tableName , settings ),
8989 Type : r .goTypeCol (Column {col , tableName }),
9090 Tags : map [string ]string {"json:" : col .Name .String ()},
9191 Comment : "" ,
@@ -164,12 +164,11 @@ func (r *Result) GoQueries(settings config.CombinedSettings) []dinosql.GoQuery {
164164 same := true
165165 for i , f := range s .Fields {
166166 c := query .Columns [i ]
167- sameName := f .Name == dinosql .StructName (columnName (c .ColumnDefinition , i ), settings )
167+ sameName := f .Name == dinosql .GetColumnName (columnName (c .ColumnDefinition , i ), s . Table . Catalog , settings )
168168 sameType := f .Type == r .goTypeCol (c )
169169
170170 hackedFQN := core.FQN {c .Table , "" , "" } // TODO: only check needed here is equality to see if struct can be reused, this type should be removed or properly used
171171 sameTable := s .Table .Catalog == hackedFQN .Catalog && s .Table .Schema == hackedFQN .Schema && s .Table .Rel == hackedFQN .Rel
172-
173172 if ! sameName || ! sameType || ! sameTable {
174173 same = false
175174 }
0 commit comments