Skip to content

Commit e0d871d

Browse files
Pass full column definition instead of just typename
1 parent 992cfa2 commit e0d871d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: internal/codegen/golang/postgresql_type.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,20 @@ func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugi
587587

588588
for _, ct := range schema.CompositeTypes {
589589
if rel.Name == ct.Name && rel.Schema == schema.Name {
590+
var ctName string
591+
if schema.Name == req.Catalog.DefaultSchema {
592+
ctName = StructName(ct.Name, options)
593+
} else {
594+
ctName = StructName(schema.Name+"_"+ct.Name, options)
595+
}
596+
590597
if notNull {
591-
return "string"
598+
return ctName
592599
}
593600
if emitPointersForNull {
594-
return "*string"
601+
return "*" + ctName
595602
}
596-
return "sql.NullString"
603+
return "Null" + ctName
597604
}
598605
}
599606
}

0 commit comments

Comments
 (0)