Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(sqlc): support emit_pointers_for_null_types for enums
  • Loading branch information
godwhoa authored and kyleconroy committed Nov 25, 2024
commit 304468b8d0c8bad26c556fbb8d171f5672785c5c
8 changes: 6 additions & 2 deletions internal/codegen/golang/postgresql_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,14 @@ func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugi
}
return StructName(schema.Name+"_"+enum.Name, options)
} else {
nullPrefix := "Null"
if emitPointersForNull {
nullPrefix = "*"
}
if schema.Name == req.Catalog.DefaultSchema {
return "Null" + StructName(enum.Name, options)
return nullPrefix + StructName(enum.Name, options)
}
return "Null" + StructName(schema.Name+"_"+enum.Name, options)
return nullPrefix + StructName(schema.Name+"_"+enum.Name, options)
}
}
}
Expand Down
Loading