bitemyapp / esqueleto

New home of Esqueleto, please file issues so we can get things caught up!
BSD 3-Clause "New" or "Revised" License
370 stars 107 forks source link

Add new Postgresql.JSON.Experimental #283

Open belevy opened 2 years ago

belevy commented 2 years ago

282

Before submitting your PR, check that you've:

After submitting your PR:

belevy commented 2 years ago

@parsonsmatt when you get a chance, would you mind taking a look at this. I added the typeclasses with the intention being to get as much reuse between MySQL and postgres as possible but then MySQL json support is still working it's way through the underlying libraries.

Vlix commented 2 years ago

@belevy I'm wondering if you couldn't just use the JSONB type from Database.Esqueleto.PostgreSQL.JSON? 🤔

And maybe also JSONBExpr? That way you can also use all the JSON operators while aggregating etc. Would also provide free SqlSelect, ToMaybe, ToAlias instances, to name a few.

Vlix commented 9 months ago

I still don't see why the JSONB newtype isn't used?

belevy commented 7 months ago

@Vlix that would require anyone using the JSONB type to agree on how it works. If there are any inconsistencies between different implementations then the type would need to be split then. As for reusing the type internally with postgres, it's possible but would require ensuring that the existing operators all work as expected there.