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

Convert nulls to undefined #336

Open
duncanbeevers opened this issue Nov 21, 2024 · 0 comments
Open

Convert nulls to undefined #336

duncanbeevers opened this issue Nov 21, 2024 · 0 comments

Comments

@duncanbeevers
Copy link

duncanbeevers commented Nov 21, 2024

⚡ Feature Request

Allow replacing null values in postgres responses with undefined.

🗣️ Discussion

  • The types generated by this package union null with the field's primitive type
  • The results returned from queries have concrete null values (matching the declared types)

However, inside our application we rarely desire null, and have to manually omit it with extra deserialization code.
This deserialization code ends up mirroring much of the schema shape, diminishing the benefit of using the generated types.

We thread data through different systems, ensuring their types conform at each technology boundary (eg; Postgres-to-OpenAPI Response), and being able to hand them around without massaging makes all of us much happier. 😄

⌛ Precedent

Many packages already provide hooks for selectively-transforming their output, either at types-generation time, or at run time.

atdatabases is uniquely situated to provide a comprehensive solution here, comprising both types-generation time and run time components.
An API allowing us to hook into both of these components to coerce data into the shapes we need would be super useful! ☘️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant