Skip to content

Improve JSON support in Esqueleto.Postgresql #282

Open
@belevy

Description

@belevy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions