Commit Graph

67 Commits

Author SHA1 Message Date
Ihor Andrianov
d968b314ed fix bug for 1 arg 2025-01-30 03:44:33 +02:00
Ihor Andrianov
ee52192cd8 add unit tests 2025-01-30 03:13:58 +02:00
Ihor Andrianov
ccf51cae80 moved is_json_valid above tests 2025-01-30 02:47:11 +02:00
Ihor Andrianov
5cf80d8cef cargo clippy 2025-01-30 02:40:35 +02:00
Ihor Andrianov
52eab0544a add Target discrete type to handle array and obj changes 2025-01-30 02:09:01 +02:00
Ihor Andrianov
30d810bfe5 add utility function to get mut ref by path 2025-01-30 00:05:53 +02:00
Ihor Andrianov
305e86ec39 allow path parser accept numbers as keys 2025-01-29 22:39:35 +02:00
Ihor Andrianov
d57d9bef6f add function definition 2025-01-29 22:37:04 +02:00
Pekka Enberg
06edf33878 Merge 'json_patch() function implementation' from Ihor Andrianov
First review #820
The function follows RFC 7386 JSON Merge Patch semantics:
* If the patch is null, the target is replaced with null
* If the patch contains a scalar value, the target is replaced with that
value
* If both target and patch are objects, the patch is recursively applied
* null values in the patch result in property removal from the target

Closes #821
2025-01-29 19:54:12 +02:00
Pekka Enberg
db72756d2a Merge 'Changes to json serialization/deserialization' from Ihor Andrianov
Change JSON deserialization to enable json_patch implementation with
SQLite-compatible behavior:
* Preserves duplicate keys in JSON objects
* Applies patches only to the first occurrence of each key
* Trade-off: Changes key lookup from O(1) to O(n) to support duplicate
keys
* Have to be merged before json_patch() function

Closes #820
2025-01-29 19:53:41 +02:00
Pekka Enberg
4af6eb2f71 Merge 'Refactor Json serialization to accommodate formatters for pretty printing' from Pedro Muniz
Json serialization logic was pulled from serde_json. Google's json5
serialization code was not flexible enough to allow for pretty printing
json, so I believe that the formatter design is a good layer to abstract
this logic. This refactor will trivially enable the implementation of
json_pretty function from sqlite. My other PR for json_quote, #763,
depends a tiny bit on a helper utility from the previous serialization
implementation. If this PR is considered first, I will change the code
in my other PR to account for this.

Reviewed-by: Diego Reis (@diegoreis42)
Reviewed-by: Kacper Madej (@madejejej)

Closes #771
2025-01-29 19:03:14 +02:00
Ihor Andrianov
0048f77b45 add unit tests 2025-01-29 18:05:41 +02:00
Ihor Andrianov
4e7c4e7ced fixes to pass tests 2025-01-29 18:05:41 +02:00
Ihor Andrianov
2407a29e90 refactored into patcher struct and made code more modular and readable 2025-01-29 18:05:40 +02:00
Ihor Andrianov
f164dbdb1e fix case where first patched value applied wins 2025-01-29 18:05:40 +02:00
Ihor Andrianov
6a605939e6 naming refine 2025-01-29 18:05:39 +02:00
Ihor Andrianov
846a73188a add json_patch implementation 2025-01-29 18:05:39 +02:00
Ihor Andrianov
5c55615896 add Removed enum type to discard removed fields on parsing stage 2025-01-29 17:59:48 +02:00
Ihor Andrianov
f97d085934 add deserialization patch to represent obj as ordered Vec and preserve duplicates 2025-01-29 17:59:48 +02:00
pedrocarlo
01626f9355 cleanup of some TODOs 2025-01-27 12:23:59 -03:00
pedrocarlo
75e78a6c70 cargo clippy 2025-01-27 12:20:13 -03:00
Harin
0903b9b019 Implemented JSON valid function 2025-01-26 23:35:47 +05:30
pedrocarlo
f77eacd90f cargo fmt 2025-01-23 03:31:01 -03:00
pedrocarlo
946d431d96 refactor of json serialization using formatters as is in serde_json 2025-01-23 03:26:05 -03:00
Pekka Enberg
bda1e4e6ab Merge 'Add support for json_object function' from Jorge Hermo
Relates to #127.  This PR is still in draft and I have a few left things
to do (tests, improve implementation), just opening it so anyone can
track this work meanwhile.

Closes #664
2025-01-20 09:36:56 +02:00
Jorge López
3da7d8cb79 syntactic changes: Markdown semantics 2025-01-18 19:20:11 +01:00
Jorge López
bbe3cded38 syntactic changes: use f64::INFINITY instead of deprecated std::f64::INFINITY 2025-01-18 19:20:11 +01:00
Jorge López
218a2e6dda syntactic changes: remove unneeded mut, lifetimes,references that get instantaneously dereferenced and casts 2025-01-18 18:43:47 +01:00
Jorge López
86a4714711 syntactic changes: remove unneeded paths when the type is already imported 2025-01-18 18:29:12 +01:00
Jorge Hermo
f7ec7bd20b feat: remove wildcard in convert_db_type_to_json 2025-01-16 19:22:39 +01:00
Jorge Hermo
15f7928551 chore: enable all features in clippy ci and fix more clippy lints 2025-01-15 23:23:12 +01:00
Jorge Hermo
f6655b38c4 chore: remove TODO 2025-01-15 22:40:13 +01:00
Jorge Hermo
f38da70920 chore: remove TODO 2025-01-15 22:38:49 +01:00
Jorge Hermo
71c9a1c9e3 chore: remove TODO 2025-01-15 22:35:56 +01:00
Jorge Hermo
8de42faa41 chore: remove TODO 2025-01-15 22:34:23 +01:00
Jorge Hermo
ac48be4ff1 chore: remove TODO 2025-01-15 22:32:00 +01:00
Jorge Hermo
fa8eb9549a Merge with main 2025-01-15 22:10:35 +01:00
김선우
8ed2d14ca4 Reposition licenses in core package 2025-01-14 19:42:09 +09:00
Jorge Hermo
fea8d19359 test: add TCL tests for json_object 2025-01-14 00:00:31 +01:00
Jorge Hermo
a4cab8e628 test: add tests for json_object 2025-01-13 23:20:15 +01:00
Jorge Hermo
c1702b34eb Merge with main 2025-01-13 22:21:13 +01:00
Pekka Enberg
1e94dbffcc Merge branch 'main' into json-error-position 2025-01-13 18:21:37 +02:00
Jorge Hermo
06208af2e8 chore: add todo 2025-01-13 01:29:32 +01:00
Jorge Hermo
e01b8f8343 feat: initial json_object implementation 2025-01-13 01:26:44 +01:00
Jorge Hermo
3785e7c7f8 feat: initial json_object implementation 2025-01-13 01:09:48 +01:00
Peter Sooley
b5fed15997 implement json_error_position 2025-01-10 11:12:30 -08:00
Kacper Madej
91d4ac3ac0 Fix expression chaining 2025-01-10 12:14:57 +07:00
Kacper Madej
0f4e5ad26d Implement simplified json path 2025-01-10 11:50:43 +07:00
Kacper Madej
743a8b2d94 Merge branch 'main' into right-arrow-json 2025-01-10 11:28:13 +07:00
Kacper Madej
74e19e2148 Optimization 2025-01-09 17:16:58 +07:00