valderman / selda

A type-safe, high-level SQL library for Haskell
https://selda.link
MIT License
478 stars 58 forks source link

JSON support on SQLite backend #116

Open valderman opened 5 years ago

valderman commented 5 years ago

This seems like it could be easily done using json1. This could be done either as a flagged (off by default) module in selda-sqlite or as a separate selda-sqlite-json1 package.

The reason for not including the functionality in selda-sqlite by default is to avoid pulling in aeson's massive list of dependencies when they're not needed.

herberteuler commented 2 years ago

I'd like to work on this. I'm going to add a flag json if that's okay.

valderman commented 2 years ago

Sounds great! I'll be happy to merge it!

herberteuler commented 2 years ago

Development happens here. I'll create a pull request when I finish.

herberteuler commented 2 years ago

An update: The json_extract function was causing troubles because it did not preserve JSON types in its results. However, SQLite >= 3.38.0 introduces the -> and ->> operators, which strive to be compatible with the PostgreSQL operators -> and ->>. I am currently working on trying these operators out.

herberteuler commented 2 years ago

Okay, with the newest SQLite 3.38.0, and a similar implementation to that of selda-postgresql, the build on my personal branch passes all of the tests. But I am not yet able to produce a pull request. Things to cover before that:

  1. Wait and see how an issue would be resolved, which is blocking the upgrade of direct-sqlite's SQLite version.
  2. Upgrade direct-sqlite's embedded SQLite version to 3.38.0. I have forked a repository, and will create a pull request for that as soon as the above issue is resolved.
  3. Tidy the changes on my branch, and finally create a pull request here.