Skip to content

Commit 304468b

Browse files
godwhoakyleconroy
authored andcommitted
feat(sqlc): support emit_pointers_for_null_types for enums
1 parent 0b952b4 commit 304468b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/codegen/golang/postgresql_type.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,14 @@ func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugi
577577
}
578578
return StructName(schema.Name+"_"+enum.Name, options)
579579
} else {
580+
nullPrefix := "Null"
581+
if emitPointersForNull {
582+
nullPrefix = "*"
583+
}
580584
if schema.Name == req.Catalog.DefaultSchema {
581-
return "Null" + StructName(enum.Name, options)
585+
return nullPrefix + StructName(enum.Name, options)
582586
}
583-
return "Null" + StructName(schema.Name+"_"+enum.Name, options)
587+
return nullPrefix + StructName(schema.Name+"_"+enum.Name, options)
584588
}
585589
}
586590
}

0 commit comments

Comments
 (0)