mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-25 20:14:21 +01:00
Implements the `json_extract` function. In the meantime, the json path has already been implemented by @petersooley in https://github.com/tursodatabase/limbo/pull/555 which is a requirement for `json_extract`. However, this PR takes a different approach and parses the JSON path using the JSON grammar, because there are a lot of quirks in how a JSON `key` can look (see the JSON grammar in the Pest file). The downside is that it allocates more memory than the current implementation, but might be easier to maintain in the long run. I included a lot of tests with some quirky behavior of the `json_extract` (some of them still need some work). I also noticed that these changed between sqlite versions (had `SQLite 3.43.2` locally and `3.45` gave different results). Due to this, I'm not sure how much value there is in trying to be fully compatible with SQLite. Perhaps the approach taken by @petersooley solves 99% of use-cases? Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #524