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

WIP: Add SQL array type support in createEntity #276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aliendrew
Copy link

@aliendrew aliendrew commented Aug 4, 2023

Closes: #275

  • tests and linter show no problems (npm t)
  • tests are added/updated for bug fixes and new features
  • code is properly formatted (npm run fmt)
  • description of changes is added in CHANGELOG.md
  • update .d.ts typings

Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

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

It looks like here is not only type support but also some refactoring.

@aliendrew
Copy link
Author

Regarding refactoring, I only changed

if (ignoreField(name, field, def)) continue;

to

if (ignoreField(name, field, def) || !def.type) continue;

to avoid unnecessary nesting inside a for loop with if (def.type) condition that included the rest of the code.
That's why diff shows deletions and insertions of the same code snippets.

Also, I did

const maxLength = def.length?.max;

because we need that maxLength not only when adding length to a generic type but also when particularly dealing with an array type.

@tshemsedinov
Copy link
Member

As of now we have unacceptable long diff for such a change. I will refactor initial code then you can rebase on master branch and update solution. Renaming to WIP (work in progress) and I'll inform you to continue. Thanks for patience.

@tshemsedinov tshemsedinov changed the title Add SQL array type support in createEntity WIP: Add SQL array type support in createEntity Aug 15, 2023
@tshemsedinov
Copy link
Member

Also, in future, it would be way to add types without changing js codebase. See metaschema, we need to extract all metadata from types and use custom types described in schemas.

@aliendrew
Copy link
Author

Got it.

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.

Add array type support for postgresql
2 participants