Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Consider supporting JSON datatypes #245

Open
alexkreidler opened this issue Dec 1, 2022 · 1 comment
Open

Consider supporting JSON datatypes #245

alexkreidler opened this issue Dec 1, 2022 · 1 comment

Comments

@alexkreidler
Copy link

馃殌 Feature Proposal

Postgrest supports selecting and filtering on json or jsonb columns: https://postgrest.org/en/stable/api.html#json-columns
It would be great if we could add this to the client.

Motivation

I want to request some specific data from a JSON column or filter by entries that have some data in a JSON column.

Example

client.selectJSON("json_data.phones[0].number")

client.lt("json_data.countries.population", 1000000)

Pitch

This would make it more convenient than having to write custom queries just for these columns.

Thanks for this great library!

I have a related question: If I wanted to use postgrester to generate a postgrest query URL and then add on to it myself (e.g. to filter JSON data), and either make the request myself/pass it back into Postgrester, what are the best functions to use?

@ivangabriele
Copy link
Owner

ivangabriele commented Dec 1, 2022

I will check that in details this weekend, this seems like a nice feature to add ^^, all together with v10 support.

As for the url builder, I need to expose this method result via a util to retrieve the generated url. I think this can indeed be useful.

But adding an option to add extra url params to get(), post(), etc methods seems a bit much, I'm not a great fan of long option lists that only covers very specific cases. I'll think about a plausible solution.

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

No branches or pull requests

2 participants