4 ms·
This is awesome! Really creative approach to the problem. Does this also support custom datatypes that can be marshalled to json? For example, PostGIS geometrie
by darksaints 5y ago
This is awesome! Really creative approach to the problem. Does this also support custom datatypes that can be marshalled to json? For example, PostGIS geometries?
- oliverrice 5y agoCurrently, any datatypes that are not in the allow list https://supabase.github.io/pg_graphql/reflection/#type-conversion https://supabase.github.io/pg_graphql/reflection/#type-conve... are cast as strings, but prioritizing a JSON conversion if one is available is a great idea that we'll look into
- darksaints 5y agoPersonally I like the idea of allowing the user to create a cast: https://www.postgresql.org/docs/current/sql-createcast.html https://www.postgresql.org/docs/current/sql-createcast.html There are some weird permissions issues to work out IIRC, but this allows the user to specify how the json should be marshalled, and then can be implicitly or explicitly used by any sql statements. This is how PostgREST solves this problem, and I currently have a few custom casts created for range and multirange datatypes through my PostgREST server.
- oreilles 5y agoDon't know how your JSON generation works but when using `row_to_json()`, all PostGIS geometries are automatically casted to GeoJSON objects by default which is very convenient.