Skip to content

Convert nulls to undefinedΒ #336

@duncanbeevers

Description

@duncanbeevers

⚑ 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! ☘️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions