Skip to content

Commit 0f39706

Browse files
authored
gen: Ignore empty override settings (#128)
The previous `goInnerType` assumed that the column name and table would be non-empty. For computed columns, this is not true. Make sure to check if the override setting (PostgresType or Column) is non-empty before applying an override.
1 parent c3f1473 commit 0f39706

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/dinosql/gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,10 @@ func (r Result) goInnerType(col core.Column) string {
445445

446446
// package overrides have a higher precedence
447447
for _, oride := range append(r.Settings.Overrides, r.packageSettings.Overrides...) {
448-
if oride.PostgresType == columnType && oride.Null != notNull {
448+
if oride.PostgresType != "" && oride.PostgresType == columnType && oride.Null != notNull {
449449
return oride.goTypeName
450450
}
451-
if oride.columnName == col.Name && oride.table == col.Table {
451+
if oride.Column != "" && oride.columnName == col.Name && oride.table == col.Table {
452452
return oride.goTypeName
453453
}
454454
}

0 commit comments

Comments
 (0)