Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for
json_set
.There are three helper functions added:
json_path_from_owned_value
, this function turns anOwnedValue
into aJsonPath
.find_or_create_target
, this function is similar tofind_target
with the added bonus of creating the target if it doesn't exist. There is a caveat with this function and that is that it will create objects/arrays as it goes, meaning if you send{}
into it and try getting the path$.some.nested.array[123].field
, it will return{"some":{"nested":array:[]}}
since creation ofsome
,nested
andarray
will succeed, but accessing element123
will fail.create_and_mutate_json_by_path
, this function is very similar tomutate_json_by_path
but callsfind_or_create_target
instead offind_target
Related to #127
Related questions: (This is my first PR in this project :) )
How do I test for errors in testing/*.test files? I added
{{Runtime errror: ...}}
and it worked fine when runningmake test
but it failed in CI?How do I run all the CI on my machine? Just so I don't have to force-push as much, I did
cargo clippy --fix
but it gave changes in unrelated files.Also, sorry for the messy Github log, I opened this PR as a draft and wrote some questions, before making it into a real PR. And while waiting for CI to finish I discovered a couple of edge cases that didn't work like sqlite did, all of those have been fixed now and test cases have been added. Some day I'll get the hang of the workflow and I'll be more thorough in the future!