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
added insert or replace #41
added insert or replace #41
Conversation
🦋 Changeset detectedLatest commit: 9049500 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thanks for the PR!
|
I missed the other question:
Generally, No. The usage here would be people looping over their own insert or insert and replace statements and batching them on their own. Performing some inserts mixed with some insert or replace would be similar to providing mixing deletes and updates in the same batch. Doesn't seem like a fit for the API. IMHO. At least at this point... because someone will always come up with something that makes sense to themselves :-) |
That's a fair point.. |
Insert and Insert or Replace will both end up yielding a result object that looks like:
another edit here... your return types seem to match that of the D1 API so there is nothing of concern here... i just ran all the combinations and looks good to me. |
We should probably update the types while doing this then. Returning Currently they're just incorrect which isn't the best. Happy to cover this in my own PR if you prefer though |
D1Result isn't null in any of these cases.... what I shared above is the output of both the ORM call and D1Database calls:
D1Result.results can be null, by its type def. Matter of fact, I think the only way D1Result can be null is if an exception occurred and there was no return. |
Ah makes sense, will give this a once over in the morning and then release 🙂 Thanks for the contribution! |
Updated tests and documentation to support providing Insert and replace with an added boolean parameter to InsertOne and InsertMany