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

feat: insert utility #97

Merged
merged 3 commits into from
Mar 18, 2022
Merged

feat: insert utility #97

merged 3 commits into from
Mar 18, 2022

Conversation

andrewwood2
Copy link
Contributor

@andrewwood2 andrewwood2 commented Mar 3, 2022

Close #93

This is a tested and working solution, however, I think before merging it would be good to discuss:

  1. if this is something that should be part of this package as it's fairly trivial for a user to create the same solution locally if they need it
  2. are there edge cases that need to be covered (so far I've just thought about happy path)

@simoneb
Copy link
Member

simoneb commented Mar 3, 2022

@Eomm please chime in

@Eomm
Copy link

Eomm commented Mar 4, 2022

if this is something that should be part of this package

I was thinking the same, but I must say that the SQL module requires some "automation" to let users migrate from an ORM to pure SQL (what I'm doing actually).
For this reason, I opened the issue to bridge this gap.

Talking off-topic, in my reasoning, the final goal would be to have utilities to build the SQL object to simplify:

  • insert
  • update
  • dynamic select condition (the filter must be added if a condition is met)

For sure we must keep these utilities as plain as possible to avoid becoming an ORM 😆

As a final thought, maybe these utilities could become:

  • an isolated file that need to be required (eg: const SQLBuilder = require('@nearform/sql/builder')
  • or a list of examples/ in the documentation

In both cases, I think we are helping the developer.

are there edge cases that need to be covered

I think that if these uses cases show up as issues, they can be covered. For sure we need to define a reasonable set of "it just works" thinks.

@andrewwood2 andrewwood2 marked this pull request as ready for review March 18, 2022 11:22
@andrewwood2
Copy link
Contributor Author

As discussed with @simoneb, moving the function to an example in the readme so that users can implement locally if desired.

@andrewwood2 andrewwood2 merged commit 55af6a1 into master Mar 18, 2022
@andrewwood2 andrewwood2 deleted the feat-insert-utility branch March 18, 2022 14:49
This was referenced Mar 26, 2022
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.

feat: INSERT utility
4 participants