Skip to content

Commit 08c808d

Browse files
committed
fix(codegen/golang): handle go_struct_tag for db_type overrides
Resolves #3143
1 parent 6ae5bcc commit 08c808d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/codegen/golang/go_type.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ func addExtraGoStructTags(tags map[string]string, req *plugin.GenerateRequest, o
1414
if oride.GoType.StructTags == nil {
1515
continue
1616
}
17+
if oride.DbType != "" {
18+
columnType := sdk.DataType(col.Type)
19+
if columnType != oride.DbType {
20+
continue
21+
}
22+
for k, v := range oride.GoType.StructTags {
23+
tags[k] = v
24+
}
25+
continue
26+
}
1727
if !override.Matches(col.Table, req.Catalog.DefaultSchema) {
1828
// Different table.
1929
continue

0 commit comments

Comments
 (0)