bitemyapp / bitemyapp/esqueleto

Improve JSON support in Esqueleto.Postgresql

Open
#282 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
399
Forks
107
Avg merge
1d 17h
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.