penberg / limbo

Limbo is a work-in-progress, in-process OLTP database management system, compatible with SQLite.
MIT License
960 stars 53 forks source link

implementation of json function `json(X)` #230

Closed JeanArhancet closed 1 month ago

JeanArhancet commented 1 month ago

Add the json function json(X) (related to the issue https://github.com/penberg/limbo/issues/127)

JeanArhancet commented 1 month ago

@penberg In the last commit, I extracted the codebase from serde_json5 to make it compliant with SQLite JSON5 specifications, such as handling double single quotes and representing +/- Infinity as 9.0e999. However, it is not yet fully compliant with SQLite. For example, a JSON string like "field": "abc\x35\x4f\x6Exyz"is currently being processed as abc\\u0035\\u004F\\u006Exyz in my implementation, whereas in SQLite, it should be abc\u0035\u004f\u006Exyz. Additionally, scientific notation is not parsed as it is in SQLite3; for example, +4.e1 results in 40.0 with my code, while in SQLite3, it would be 4.0e1.

Do you think this implementation is acceptable for an initial attempt?

penberg commented 1 month ago

It is totally fine! Lets just make sure tests pass