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

fix: Support array values for queries and string type for inserts #864

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

darunrs
Copy link
Collaborator

@darunrs darunrs commented Jul 11, 2024

Context DB in the frontend was showing an error for inserts and select. For inserts, some types such as date would expect Date type when string type also works. I updated the type gen to allow string type input for these options. This ensures string or number input is acceptable for essentially all types.
image

In addition, selection queries allow for array input to match muliple values for a certain column. However, the frontend was not updated to accept this input. I've added a new interface called Query which allows for array values in input objects.
Uploading image.png…

@@ -204,30 +204,33 @@ export class PgSchemaTypeGen {

tableList.add(sanitizedTableName);

let queryDefinition = `declare interface ${sanitizedTableName}Query {\n`;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will actually get rid of this file relatively soon in favor of a new class in Runner which handles Postgres DLL Parsing logic. Part of its functionality will be producing the TS file string. This will prevent issues like this in the future where backend features get supported while the frontend acts as though it isn't supported.

@darunrs darunrs marked this pull request as ready for review July 11, 2024 11:31
@darunrs darunrs requested a review from a team as a code owner July 11, 2024 11:31
@darunrs darunrs merged commit 3655d91 into main Jul 12, 2024
4 checks passed
@darunrs darunrs deleted the fix-type-gen-string branch July 12, 2024 03:58
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

Successfully merging this pull request may close these issues.

2 participants