-
-
Notifications
You must be signed in to change notification settings - Fork 708
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
Add DatabaseValueConvertible
tip for JSON columns
#1649
Conversation
DatabaseValueConvertible
tipDatabaseValueConvertible
tip for JSON columns
Hello @bok-, Thank you for sharing your experience and suggesting this tip in the documentation! I'm happy if your application can profit from this technique, because it is handy. Now, the sample code has SQLite perform string comparison, which is sensitive to white space and key ordering, etc. It only works reliably if all database values in the If this precondition is not fulfilled, the test will fail to match some addresses. There are plenty of reasons:
In summary:
In summary, this technique is a clever hack. I love clever hacks, but documentation must not drive users into writing code that may fail them at some point. They would be upset, and rightly so. Primum non nocere. |
Maybe it is possible to find a short and clear way to express the precondition. What about:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made up my mind :-) I hope you'll agree with this little amendment.
Merged :-) Thank you @bok- 👍 |
⛵ Shipped in 7.0.0-beta.3 |
Forgot to come back to this one! Yep totally agree with the improved wording and the warning about consequences! Thanks very much 🙏 |
This PR adds a tip to the JSON page of the DocC docs about conforming your JSON column's Codable property to
DatabaseValueConvertible
for filtering. Adding my first JSON column and this would have saved me a couple of hours of digging.Please feel free to rewrite if it doesn't match the tone or intent of existing documentation.
Pull Request Checklist
development
branch.TESTS: Changes are tested.TESTS: Themake smokeTest
terminal command runs without failure.