Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JSON support in Esqueleto.Postgresql #282

Open
belevy opened this issue Sep 10, 2021 · 2 comments
Open

Improve JSON support in Esqueleto.Postgresql #282

belevy opened this issue Sep 10, 2021 · 2 comments

Comments

@belevy
Copy link
Collaborator

belevy commented Sep 10, 2021

As a user I would like to be able to extract JSON values from a query. This would be useful for faking multiset support similar to jOOQ.

Proposed Additions

  • Add a new JsonValue newtype wrapper with a SqlSelect based on JSON parsing
  • Add support for to_json on SqlExpr (Value a) and SqlExpr (Entity a) and tuples (up to 8?)
    • Value a is trivially implemented using the built in to_json
    • Entity a can use the entityDef to json_build_object assuming that the FieldDef.fieldHaskell matches the default persistent json
    • Tuples can be represented using json_build_array
  • Add support for json_agg :: SqlExpr (JsonValue a) -> SqlExpr (JsonValue [a]) this is limited to JsonValue to enforce the use of our to_json implementation instead of relying on the default postgres behavior.
@rjmholt
Copy link

rjmholt commented Nov 10, 2022

Given #284, it might be worth closing this issue as resolved

@belevy
Copy link
Collaborator Author

belevy commented Nov 29, 2022

Not sure what #284 has to do with this issue? #283 is the PR associated with this issud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants