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

Option to ignore missing props on params #10

Closed
wants to merge 2 commits into from

Conversation

dwelch2344
Copy link

This library is awesome and a cornerstone of all our data access. However, one thing we've continually found ourselves wishing for is the ability to ignore missing params and supply PG with a null value.

This is a crud example, written in the Github editor, but feels like it'd cover most of what we'd like to see. We don't use any of the file scanning, so would love some feedback and direction on how this could be written to make it into core. Happy to write tests / docs as needed.

Thanks for the great OSS contribution :)

This library is awesome and a cornerstone of all our data access. However, one thing we've continually found ourselves wishing for is the ability to ignore missing params and supply PG with a null value. 

This is a crud example, written in the Github editor, but feels like it'd cover most of what we'd like to see. We don't use any of the file scanning, so would love some feedback and direction on how this could be written to make it into core. Happy to write tests / docs as needed. 

Thanks for the great OSS contribution :)
@pihvi
Copy link
Owner

pihvi commented Feb 2, 2019

Thanks for your kind words, nice to hear there is use for this lib!

The solution looks like a good approach. So the idea would be to call some SQL statement with less parameters than in the statement and then insert NULL for the missing parameters. Maybe the config property name would be better then to be "useNullOnMissing". Then the solution would need to make sure it works on SQLite MySQL/Maria and Postgres. I can start working on this. Tests and docs are also very welcome.

@pihvi
Copy link
Owner

pihvi commented Dec 20, 2019

Well this took a while, sorry.. fortunately the holidays came :)

This is now available in version 4.1.0 wiyh flag "useNullForMissing"
Is this working for you as expected?

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