Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support generating pointers for nullable enum types (emit_pointers_for_null_types for enums) #3276

Open
nderscore opened this issue Mar 15, 2024 · 0 comments
Labels
enhancement New feature or request triage New issues that hasn't been reviewed

Comments

@nderscore
Copy link

nderscore commented Mar 15, 2024

What do you want to change?

Currently, when a field is nullable and an enum, sqlc always generates a new type with a prefix Null. This Null___ type is a struct that wraps the enum's string alias type and adds a Valid boolean property to represent the NULL state.

sqlc has a setting called emit_pointers_for_null_types which replaces similar nullable wrapper types with pointers instead (NullString -> *string)

This feature request seeks to bring similar functionality to nullable enum fields. Instead of generating a Null___ type for a nullable enum field, it should be a represented by a pointer (NullFooEnum -> *FooEnum)

Questions

  • If this feature were to be implemented, should it be enabled by the existing emit_pointers_for_null_types config setting? Or should it be a separate setting?

Other notes

I couldn't find an existing issue for this, but there is an open PR #3093 which seemed to be working towards the same goal.

What database engines need to be changed?

No response

What programming language backends need to be changed?

No response

@nderscore nderscore added enhancement New feature or request triage New issues that hasn't been reviewed labels Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage New issues that hasn't been reviewed
Projects
None yet
Development

No branches or pull requests

1 participant